Skip to content

Commit

Permalink
Prevent a possible nil object from being inserted into an NSDictionary.
Browse files Browse the repository at this point in the history
  • Loading branch information
gioneill committed Mar 20, 2019
1 parent 060f8a3 commit d73b572
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Simplified/NYPLOPDSFeed.m
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,14 @@ - (instancetype)initWithXML:(NYPLXML *const)feedXML
// Sometimes we get back JUST an entry, and in that case we just want to construct a feed with
// nothing set other than the entry.
if ([feedXML.name isEqual:@"entry"]) {
self.entries = @[[[NYPLOPDSEntry alloc] initWithXML:feedXML]];
return self;
NYPLOPDSEntry const* entry = [[NYPLOPDSEntry alloc] initWithXML:feedXML];
if (entry) {
self.entries = @[entry];
return self;
} else {
NYPLLOG(@"Error creating single OPDS entry from feed.");
return nil;
}
}

if(!((self.identifier = [feedXML firstChildWithName:@"id"].value))) {
Expand Down

0 comments on commit d73b572

Please sign in to comment.