/Added-check-for-NSNull-to-avoid-crash-when-an-incoming-JSON-record-has-a-null-DateTime-value.patch Secret
Created
February 9, 2009 05:09
-
-
Save adamalex/698715468c4118d1b93b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 68adf9b1c7505bb498561016112925dfbf6da4f9 Mon Sep 17 00:00:00 2001 | |
From: Adam Alexander <adamalex@gmail.com> | |
Date: Mon, 9 Feb 2009 00:09:31 -0500 | |
Subject: [PATCH] Added check for NSNull to avoid crash when an incoming JSON record has a null DateTime value | |
--- | |
Classes/lib/Serialization/NSDate+Serialize.m | 2 +- | |
1 files changed, 1 insertions(+), 1 deletions(-) | |
diff --git a/Classes/lib/Serialization/NSDate+Serialize.m b/Classes/lib/Serialization/NSDate+Serialize.m | |
index 6f49a33..3d06aca 100644 | |
--- a/Classes/lib/Serialization/NSDate+Serialize.m | |
+++ b/Classes/lib/Serialization/NSDate+Serialize.m | |
@@ -13,7 +13,7 @@ | |
@implementation NSDate(Serialize) | |
+ (NSDate *) deserialize:(id)value { | |
- return [ObjectiveResourceDateFormatter parseDateTime:value]; | |
+ return (value == [NSNull null]) ? nil : [ObjectiveResourceDateFormatter parseDateTime:value]; | |
} | |
- (NSString *) serialize { | |
-- | |
1.6.1.1+GitX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment