Skip to content

Commit 4a1835f

Browse files
Fix an issue preventing interoperability with Swift
Optional values may be set to `null` in JSON. When the data is parsed this turns into `NSNull` which isn’t equal to nil. Setting the attribute to `NSNull` leads to a type mismatch so it needs to be included in the comparison so that scenario can be prevented.
1 parent 21cb650 commit 4a1835f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Classes/JSONAPIResourceParser.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ + (void)set:(NSObject <JSONAPIResource> *)resource withDictionary:dictionary {
205205

206206
} else {
207207
id value = [attributes objectForKey:[property jsonName]];;
208-
if (nil == value) {
208+
if ((id)[NSNull null] == value) {
209209
value = [dictionary objectForKey:[property jsonName]];
210210
}
211211

0 commit comments

Comments
 (0)