mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
* Source/NSNumberFormatter.m
(-attributedStringForObjectValue:withDefaultAttributes:): Guard against initializing an NSAttributedString with a nil string. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33596 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e626936660
commit
5c802d5d57
2 changed files with 15 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2011-07-20 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSNumberFormatter.m
|
||||
(-attributedStringForObjectValue:withDefaultAttributes:):
|
||||
Guard against initializing an NSAttributedString with a nil string.
|
||||
|
||||
2011-07-20 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSAttributedString.m: Throw an exception if the string object
|
||||
|
|
|
@ -437,6 +437,7 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
|
|||
- (NSAttributedString*) attributedStringForObjectValue: (id)anObject
|
||||
withDefaultAttributes: (NSDictionary*)attr
|
||||
{
|
||||
NSString *stringForObjectValue;
|
||||
NSDecimalNumber *zeroNumber = [NSDecimalNumber zero];
|
||||
NSDecimalNumber *nanNumber = [NSDecimalNumber notANumber];
|
||||
|
||||
|
@ -468,8 +469,15 @@ static NSUInteger _defaultBehavior = NSNumberFormatterBehavior10_4;
|
|||
attr = _attributesForNegativeValues;
|
||||
}
|
||||
|
||||
stringForObjectValue = [self stringForObjectValue: anObject];
|
||||
|
||||
if (stringForObjectValue == nil)
|
||||
{
|
||||
stringForObjectValue = @"";
|
||||
}
|
||||
|
||||
return AUTORELEASE([[NSAttributedString alloc] initWithString:
|
||||
[self stringForObjectValue: anObject] attributes: attr]);
|
||||
stringForObjectValue attributes: attr]);
|
||||
}
|
||||
|
||||
- (NSAttributedString*) attributedStringForNil
|
||||
|
|
Loading…
Reference in a new issue