Skip to content

Commit 27ddc70

Browse files
authored
Merge pull request #30 from SportlabsTechnology/FixCrashOnDeserializeInputObjectWithOptionalField
Fix crash on deserialize input object with optional field
2 parents 9202d5a + 2e6556a commit 27ddc70

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Sources/GraphQL/Execution/Values.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func coerceValue(type: GraphQLInputType, value: Map) throws -> Map? {
147147
var objCopy = obj
148148
let field = fields[fieldName]
149149

150-
var fieldValue = try coerceValue(type: field!.type, value: value[fieldName]!)
150+
var fieldValue = try coerceValue(type: field!.type, value: value[fieldName] ?? .null)
151151

152152
if fieldValue == .null {
153153
fieldValue = field?.defaultValue

0 commit comments

Comments
 (0)