Permit nil string in init

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@5504 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-12-14 08:40:41 +00:00
parent 538f642fd1
commit 9ddb1ee5c6
2 changed files with 7 additions and 6 deletions

View file

@ -1,11 +1,11 @@
Tue Dec 14 5:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Tue Dec 14 8:40:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSTimeZone.m: ([+getTimeZoneFile:]) Removed misleading comment
and hack.
([+timeZoneWithName:]) Fixed bug in loading timezone data file (unusual
formats could cause a crash).
* Source/NSScanner.m: ([-initWithString:]) fix to handle being passed
a nil string (return nil and log a warning).
a nil string (use an empty string and log an error).
* NSTimeZones/NSTimeZones.tar: updated to latest info and made sure
files are in the correct place.

View file

@ -110,17 +110,18 @@ typedef struct {
*/
- (id) initWithString: (NSString *)aString
{
[super init];
if ((self = [super init]) == nil)
return nil;
/*
* Ensure that we have an NSGString so we can access its internals directly.
*/
if (aString == nil)
{
RELEASE(self);
NSLog(@"Scanner initialised with nil string");
return nil;
aString = @"";
}
else if (fastClass(aString) == NSGString_class)
if (fastClass(aString) == NSGString_class)
{
_isUnicode = YES;
_string = RETAIN(aString);