mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 16:30:41 +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
|
@ -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>
|
2011-07-19 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/Makefile.postamble:
|
* Source/Makefile.postamble:
|
||||||
|
|
|
@ -461,6 +461,17 @@ _attributesAtIndexEffectiveRange(
|
||||||
{
|
{
|
||||||
NSZone *z = [self zone];
|
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];
|
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||||
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
||||||
{
|
{
|
||||||
|
@ -562,6 +573,17 @@ _attributesAtIndexEffectiveRange(
|
||||||
{
|
{
|
||||||
NSZone *z = [self zone];
|
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];
|
_infoArray = [[NSMutableArray allocWithZone: z] initWithCapacity: 1];
|
||||||
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
if (aString != nil && [aString isKindOfClass: [NSAttributedString class]])
|
||||||
{
|
{
|
||||||
|
|
|
@ -366,7 +366,7 @@ appendUIntData(NSMutableData *d, NSUInteger i)
|
||||||
//Creating an NSAttributedString
|
//Creating an NSAttributedString
|
||||||
- (id) init
|
- (id) init
|
||||||
{
|
{
|
||||||
return [self initWithString: nil attributes: nil];
|
return [self initWithString: @"" attributes: nil];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue