NSBundle URLForResource fix

This commit is contained in:
Autorelease Pool 2011-10-12 17:06:29 +02:00
parent 67ab18d56d
commit 2fda5f3f53

View File

@ -651,7 +651,8 @@ static NSMapTable *pathToObject=NULL;
- (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)extension {
NSString *path = [self pathForResource:name ofType:extension inDirectory:nil];
return [NSURL fileURLWithPath:path];
// attention: fileURLWithPath returns a non-nil object for nil input, we don't want that
return path ? [NSURL fileURLWithPath:path] : nil;
}
-(NSArray *)pathsForResourcesOfType:(NSString *)type inDirectory:(NSString *)path forLocalization:(NSString *)localization {