mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Make the use of nil for a file URL path raise an invalid argument exception
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33939 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4b08c19756
commit
c71ffe21e9
4 changed files with 33 additions and 4 deletions
|
@ -1899,10 +1899,17 @@ IF_NO_GC(
|
|||
subdirectory: (NSString *)subpath
|
||||
localization: (NSString *)localizationName
|
||||
{
|
||||
return [NSURL fileURLWithPath: [self pathForResource: name
|
||||
ofType: ext
|
||||
inDirectory: subpath
|
||||
forLocalization: localizationName]];
|
||||
NSString *path;
|
||||
|
||||
path = [self pathForResource: name
|
||||
ofType: ext
|
||||
inDirectory: subpath
|
||||
forLocalization: localizationName];
|
||||
if (nil == path)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
return [NSURL fileURLWithPath: path];
|
||||
}
|
||||
|
||||
+ (NSArray*) _pathsForResourcesOfType: (NSString*)extension
|
||||
|
|
|
@ -640,6 +640,12 @@ static NSUInteger urlAlign;
|
|||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL flag = NO;
|
||||
|
||||
if (nil == aPath)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"[%@ %@] nil string parameter",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [[mgr currentDirectoryPath]
|
||||
|
@ -667,6 +673,12 @@ static NSUInteger urlAlign;
|
|||
NSFileManager *mgr = [NSFileManager defaultManager];
|
||||
BOOL flag = NO;
|
||||
|
||||
if (nil == aPath)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"[%@ %@] nil string parameter",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||
}
|
||||
if ([aPath isAbsolutePath] == NO)
|
||||
{
|
||||
aPath = [[mgr currentDirectoryPath]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue