Skip to content

Commit

Permalink
Crash when addind nil to an array correction
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérémy Lagrue committed Aug 20, 2014
1 parent c67cb12 commit 91e8f81
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions TBXML+NSDictionary/TBXML+NSDictionary.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ + (NSDictionary*)dictionaryWithXMLNode:(TBXMLElement*)element
[elementDict addEntriesFromDictionary:[self dictionaryWithXMLNode:childElement]];

} else if ([[elementDict objectForKey:[TBXML elementName:childElement]] isKindOfClass:[NSArray class]]) {

NSMutableArray *items = [[NSMutableArray alloc] initWithArray:[elementDict objectForKey:[TBXML elementName:childElement]]];
[items addObject:[[self dictionaryWithXMLNode:childElement] objectForKey:[TBXML elementName:childElement]]];
[elementDict setObject:[NSArray arrayWithArray:items] forKey:[TBXML elementName:childElement]];
items = nil;


if ([[self dictionaryWithXMLNode:childElement] objectForKey:[TBXML elementName:childElement]]) {
NSMutableArray *items = [[NSMutableArray alloc] initWithArray:[elementDict objectForKey:[TBXML elementName:childElement]]];
[items addObject:[[self dictionaryWithXMLNode:childElement] objectForKey:[TBXML elementName:childElement]]];
[elementDict setObject:[NSArray arrayWithArray:items] forKey:[TBXML elementName:childElement]];
items = nil;
}

} else {

if ([elementDict objectForKey:[TBXML elementName:childElement]] && [[self dictionaryWithXMLNode:childElement] objectForKey:[TBXML elementName:childElement]]) {
Expand Down

0 comments on commit 91e8f81

Please sign in to comment.