mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
* Source/GSAttributedString.m: Throw an exception if the string object
passed to -initWithString:attributes: doesn't respond to -length, or if it is nil. This is the same behaviour as OS X. * Source/NSAttributedString.m (-init): Call -initWithString:attributes: with @"" instead of nil, since passing nil now causes an exception to be thrown. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33595 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
12dee189f3
commit
e626936660
3 changed files with 32 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
|||
2011-07-20 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSAttributedString.m: Throw an exception if the string object
|
||||
passed to -initWithString:attributes: doesn't respond to -length, or if
|
||||
it is nil. This is the same behaviour as OS X.
|
||||
* Source/NSAttributedString.m (-init): Call -initWithString:attributes:
|
||||
with @"" instead of nil, since passing nil now causes an exception
|
||||
to be thrown.
|
||||
|
||||
2011-07-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Makefile.postamble:
|
||||
|
|
|
@ -461,6 +461,17 @@ _attributesAtIndexEffectiveRange(
|
|||
{
|
||||
NSZone *z = [self zone];
|
||||
|
||||
if (nil == aString)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"aString object passed to -[GSAttributedString initWithString:attributes:] is nil"];
|
||||
}
|
||||
if (![aString respondsToSelector: @selector(length)])
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"aString object passed to -[GSAttributedString initWithString:attributes:] does not respond to -length"];
|
||||
}
|
||||
|
||||
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
||||
{
|
||||
|
@ -562,6 +573,17 @@ _attributesAtIndexEffectiveRange(
|
|||
{
|
||||
NSZone *z = [self zone];
|
||||
|
||||
if (nil == aString)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"aString object passed to -[GSAttributedString initWithString:attributes:] is nil"];
|
||||
}
|
||||
if (![aString respondsToSelector: @selector(length)])
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"aString object passed to -[GSAttributedString initWithString:attributes:] does not respond to -length"];
|
||||
}
|
||||
|
||||
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
||||
{
|
||||
|
|
|
@ -366,7 +366,7 @@ appendUIntData(NSMutableData *d, NSUInteger i)
|
|||
//Creating an NSAttributedString
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithString: nil attributes: nil];
|
||||
return [self initWithString: @"" attributes: nil];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue