cope with bad data

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@26526 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2008-05-14 09:44:29 +00:00
parent 0b9ee6f603
commit 62c268c19f
2 changed files with 20 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2008-05-14 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSDocumentController.m: Cope with bad values in NSRecentItems
2008-05-13 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSGlyphGenerator.h,

View file

@ -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