Permalink
Browse files

Merge pull request #20 from wordpress-mobile/invalid-dates

Ignore invalid/null dates
  • Loading branch information...
2 parents f9b7685 + d46a6a5 commit 18c723821abbd76b5a701bb19f67d5b6e8592f33 @eczarny committed Apr 27, 2012
Showing with 9 additions and 1 deletion.
  1. +9 −1 XMLRPCEventBasedParserDelegate.m
@@ -267,7 +267,11 @@ - (void)addElementValueToParent {
break;
case XMLRPCElementTypeDictionary:
- [parentElementValue setObject: myElementValue forKey: myElementKey];
+ if ([myElementValue isEqual:[NSNull null]]) {
+ [parentElementValue removeObjectForKey:myElementKey];
+ } else {
+ [parentElementValue setObject: myElementValue forKey: myElementKey];
+ }
break;
case XMLRPCElementTypeMember:
@@ -329,6 +333,10 @@ - (NSDate *)parseDate: (NSString *)value {
result = [self parseDateString: value withFormat: @"yyyy'-'MM'-'dd'T'HH:mm:ss"];
}
+ if (!result) {
+ result = (NSDate *)[NSNull null];
+ }
+
return result;
}

0 comments on commit 18c7238

Please sign in to comment.