Skip to content

Commit

Permalink
Fixes 256106
Browse files Browse the repository at this point in the history
      
Sparkle will no longer break on nil XML nodes; that would occur when a node is commented out. Thanks to Christiaan Hofman for the patch.
  • Loading branch information
andymatuschak committed Aug 11, 2008
1 parent 32a804e commit 0343569
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions SUAppcast.m
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,16 @@ - (void)connectionDidFinishLoading:(NSURLConnection *)connection
while (nil != node)
{
NSString *name = [node name];
NSMutableArray *nodes = [nodesDict objectForKey:name];
if (nodes == nil)
if (name)
{
nodes = [NSMutableArray array];
[nodesDict setObject:nodes forKey:name];
NSMutableArray *nodes = [nodesDict objectForKey:name];
if (nodes == nil)
{
nodes = [NSMutableArray array];
[nodesDict setObject:nodes forKey:name];
}
[nodes addObject:node];
}
[nodes addObject:node];

node = [node nextSibling];
}
}
Expand Down Expand Up @@ -196,10 +198,10 @@ - (NSXMLNode *)bestNodeInNodes:(NSArray *)nodes
while ((node = [nodeEnum nextObject]))
{
lang = [[node attributeForName:@"xml:lang"] stringValue];
[languages addObject:(lang ?: @"")]; // Default to a key being English if no xml:lang is specified.
[languages addObject:(lang ?: @"")];
}
lang = [[NSBundle preferredLocalizationsFromArray:languages] objectAtIndex:0];
i = [languages indexOfObject:(lang ?: @"")];
i = [languages indexOfObject:([languages containsObject:lang] ? lang : @"")];
if (i == NSNotFound)
i = 0;
return [nodes objectAtIndex:i];
Expand Down

0 comments on commit 0343569

Please sign in to comment.