mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-22 14:35:52 +00:00
Fixed: CPDateFormatter getObjectValue: with nil errorDescription crash.
Like for all formatters, a nil errorDescription just means we don't care about the error description if there is an error. Fixes #2030.
This commit is contained in:
1 parent
7662f89193
commit
21aac76ba2
2 files changed
+13
-2
No files matched your search
@@ -1208,7 +1208,9 @@ var defaultDateFormatterBehavior = CPDateFormatterBehavior10_4,
|
||||
|
||||
if (!value)
|
||||
{
|
||||
@deref(anError) = @"The value \"" + aString + "\" is invalid.";
|
||||
if (anError)
|
||||
@deref(anError) = @"The value \"" + aString + "\" is invalid.";
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
|
||||
@@ -1171,6 +1171,15 @@
|
||||
[self assert:result equals:nil];
|
||||
}
|
||||
|
||||
- (void)testGetObjectValueAcceptsNilErrorDescription
|
||||
{
|
||||
var date = nil,
|
||||
result = [_dateFormatter getObjectValue:@ref(date) forString:@"a" errorDescription:nil];
|
||||
|
||||
[self assertFalse:result];
|
||||
[self assertTrue:date === nil];
|
||||
}
|
||||
|
||||
- (void)testGetObjectValueReturnYes
|
||||
{
|
||||
[_dateFormatter setDateFormat:@"d mm"];
|
||||
@@ -1179,7 +1188,7 @@
|
||||
error = @"",
|
||||
result = [_dateFormatter getObjectValue:@ref(date) forString:@"10 12" errorDescription:@ref(error)];
|
||||
|
||||
[self assert:result equals:YES];
|
||||
[self assertTrue:result];
|
||||
[self assert:date equals:[[CPDate alloc] initWithString:@"2000-01-10 08:12:00 +0000"]];
|
||||
[self assert:error equals:@""];
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user