mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-04 16:12:58 +00:00
Fixed: CPNumberFormatter formatted @"" as any number.
Without this fix, `- CPNumberFormatter getObjectValue:forString:errorDescription:` would return `YES` for string @"", like if it was properly converted to an object value, but then actually leave object value unchanged. With this fix object value is set to nil like in Cocoa. Refs #1829.
This commit is contained in:
1 parent
c550cd7afb
commit
39b49d47f9
1 file changed
+4
-1
@@ -183,9 +183,12 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
|
||||
|
||||
- (BOOL)getObjectValue:(id)anObjectRef forString:(CPString)aString errorDescription:(CPString)anErrorRef
|
||||
{
|
||||
// allows an empty string to pass without validation
|
||||
// Interpret an empty string as nil, like in Cocoa.
|
||||
if (aString === @"")
|
||||
{
|
||||
@deref(anObjectRef) = nil;
|
||||
return YES;
|
||||
}
|
||||
|
||||
var value = [self numberFromString:aString],
|
||||
error = @"";
|
||||
|
||||
Reference in new issue
Block a user