Check for array with no objects

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15032 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2002-11-20 15:14:07 +00:00
parent 4d44332b79
commit 8fb4fc795d
2 changed files with 13 additions and 4 deletions

View file

@ -1,3 +1,9 @@
2002-11-20 Adam Fedor <fedor@gnu.org>
* Source/NSBundle.m (+preferredLocalizationsFromArray:forPreferences:):
Check for array with no objects.
([NSBundle -localizedInfoDictionary]): Idem.
2002-11-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Additions/Unicode.m: Work around bug in the redhat 8 iconv

View file

@ -1319,18 +1319,21 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
[array addObject: locale];
}
/* I guess this is arbitrary if we can't find a match? */
if ([array count] == 0)
if ([array count] == 0 && [localizationsArray count] > 0)
[array addObject: [localizationsArray objectAtIndex: 0]];
return [array makeImmutableCopyOnFail: NO];
}
- (NSDictionary *)localizedInfoDictionary
{
NSString* path;
NSString* locale;
NSString *path;
NSArray *locales;
NSString *locale = nil;
NSDictionary *dict = nil;
locale = [[self preferredLocalizations] objectAtIndex: 0];
locales = [self preferredLocalizations];
if ([locales count] > 0)
locale = [locales objectAtIndex: 0];
path = [self pathForResource: @"Info-gnustep"
ofType: @"plist"
inDirectory: nil