Return nil when initializing a bundle with a non-existing or non-readable

path; fixed memory leak for nil path during init


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@12759 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 2002-02-25 15:28:06 +00:00
parent b0b2b38979
commit 092e1d508e

View file

@ -706,13 +706,14 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
if (!path || [path length] == 0)
{
NSLog(@"No path specified for bundle");
[self dealloc];
return nil;
}
if ([path isAbsolutePath] == NO)
{
NSLog(@"WARNING: NSBundle -initWithPath: requires absolute path names!");
path = [[[NSFileManager defaultManager] currentDirectoryPath]
stringByAppendingPathComponent: path];
stringByAppendingPathComponent: path];
}
/* Check if we were already initialized for this directory */
@ -746,8 +747,8 @@ _bundle_load_callback(Class theClass, struct objc_category *theCategory)
if (bundle_directory_readable(path) == NO)
{
NSDebugMLLog(@"NSBundle", @"Could not access path %@ for bundle", path);
//[self dealloc];
//return nil;
[self dealloc];
return nil;
}
_path = [path copy];