mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-29 16:01:38 +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
9623471068
commit
5800130467
3 changed files with 32 additions and 1 deletions
|
@ -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]])
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue