Bug fix for Nerdfeed


addItemsFromChannel: does not work if the cache is empty, because you are sending the addObject: message to nil.

My solution was to test for that condition and set ‘items’


@property (nonatomic, strong) NSMutableArray *items;


- (void)addItemsFromChannel:(RSSChannel *)otherChannel
    for (RSSItem *i in [otherChannel items]) {      
        // Cater for cache being empty
        if (![self items]) {            
            NSMutableArray *myItems = [NSMutableArray arrayWithObject:i];
            [self setItems:myItems];
        // If self's items does not contain this item, we add this item   
        if (![[self items] containsObject:i]) {            
            [[self items] addObject:i];
        // Sort the array of items by publication date        
        [[self items] sortUsingComparator:^NSComparisonResult(id obj1, id obj2) {
            return [[obj2 publicationDate] compare:[obj1 publicationDate]];


thanks for pointing this out!!!