diff --git a/ChangeLog b/ChangeLog index 6ce12bbd5..79b4f17ef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2008-05-14 Richard Frith-Macdonald + + * Source/NSDocumentController.m: Cope with bad values in NSRecentItems + 2008-05-13 Fred Kiefer * Headers/AppKit/NSGlyphGenerator.h, diff --git a/Source/NSDocumentController.m b/Source/NSDocumentController.m index 63c1e6fc3..6440dcdd4 100644 --- a/Source/NSDocumentController.m +++ b/Source/NSDocumentController.m @@ -177,13 +177,27 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ if (_recent_documents) { int i, count; + _recent_documents = [_recent_documents mutableCopy]; count = [_recent_documents count]; for (i = 0; i < count; i++) { + NSString *str; NSURL *url; - url = [NSURL URLWithString: [_recent_documents objectAtIndex: i]]; - [_recent_documents replaceObjectAtIndex: i withObject: url]; + + str = [_recent_documents objectAtIndex: i]; + url = [NSURL URLWithString: str]; + if (url == nil) + { + NSLog(@"NSRecentItems value '%@' is not valid ... ignored", str); + [_recent_documents removeObjectAtIndex: i]; + i--; + count--; + } + else + { + [_recent_documents replaceObjectAtIndex: i withObject: url]; + } } } else