Skip to content

Commit

Permalink
=>? should accept NSNull #70
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Jan 22, 2016
1 parent 0c91e1e commit 8e3fea1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Decodable.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,11 @@
children = (
8FE7B5651B4C9FB900837609 /* Decodable.h */,
8F012EEF1BB414D4007D0B5C /* Playground.playground */,
8FE7B57C1B4CA01400837609 /* Decodable.swift */,
65DB18AF1C29AC0E003BDA5C /* RawRepresentableDecodable.swift */,
8F012EF41BB5A920007D0B5C /* Castable.swift */,
8F72DC551C3CB8C500A39E10 /* NSValueCastable.swift */,
8F956D1E1B4D6FF700243072 /* Operators.swift */,
8FE7B57C1B4CA01400837609 /* Decodable.swift */,
8F012EF41BB5A920007D0B5C /* Castable.swift */,
8FFAB8111B7CFA9500E2D724 /* Parse.swift */,
8F87BCC31B592F0E00E53A8C /* DecodingError.swift */,
8FE7B5671B4C9FB900837609 /* Info.plist */,
Expand Down
2 changes: 1 addition & 1 deletion Sources/Parse.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func parseAndAcceptMissingKey<T>(json: AnyObject, path: [String], decode: (AnyOb
guard let object = try catchMissingKeyAndReturnNil({ try parse(json, path) }) else {
return nil
}
return try catchAndRethrow(json, path) { try decode(object) }
return try catchAndRethrow(json, path) { try catchNull(decode)(object) }
}


Expand Down
2 changes: 1 addition & 1 deletion Tests/MissingKeyOperatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class MissingKeyOperatorTests: XCTestCase {
func testNSNull() {
// Should return nil
let dictionary: NSDictionary = ["key": NSNull()]
let result: Int? = try! dictionary =>? "MissingKeyError"
let result: Int? = try! dictionary =>? "key"
XCTAssertEqual(result, nil)
}

Expand Down

0 comments on commit 8e3fea1

Please sign in to comment.