Skip to content

Commit

Permalink
Return nil immediately if somebody tries to parse nil. (Otherwise, Ba…
Browse files Browse the repository at this point in the history
…d Things will happen when we try to parse the C string.)

Reported by @cruffenach: boredzo/iso-8601-date-formatter#7
  • Loading branch information
boredzo committed Aug 21, 2013
1 parent 3bd0c07 commit 3c12abc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ISO8601DateFormatter.m
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ - (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out
return [self dateComponentsFromString:string timeZone:outTimeZone range:NULL fractionOfSecond:NULL];
}
- (NSDateComponents *) dateComponentsFromString:(NSString *)string timeZone:(out NSTimeZone **)outTimeZone range:(out NSRange *)outRange fractionOfSecond:(out NSTimeInterval *)outFractionOfSecond {
if (string == nil)
return nil;

NSDate *now = [NSDate date];

NSDateComponents *components = [[[NSDateComponents alloc] init] autorelease];
Expand Down

0 comments on commit 3c12abc

Please sign in to comment.