Explicitly roll over to zero when the element isn't found.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@26870 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2008-09-24 12:29:15 +00:00
parent 500adbbfd3
commit 0871d54a82
2 changed files with 10 additions and 1 deletions

View file

@ -925,7 +925,10 @@ static BOOL setSharedDefaults = NO; /* Flag to prevent infinite recursion */
if (self == sharedDefaults) invalidatedLanguages = YES;
[_searchList removeObject: aName];
index = [_searchList indexOfObject: processName];
index++; // NSNotFound wraps to zero ... insert at start.
if(index == NSNotFound)
{
index = 0; // NSNotFound, insert at start.
}
aName = [aName copy];
[_searchList insertObject: aName atIndex: index];
[_lock unlock];