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:
rfm 2008-05-14 09:44:29 +00:00
parent a28640077e
commit 7d18cf6aad
2 changed files with 20 additions and 2 deletions

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