Skip to content

Commit b7dd031

Browse files
committed
Fix NPE when coercing a null into a String
1 parent 2a8b6d3 commit b7dd031

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/graphql/Scalars.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public Object coerceLiteral(Object input) {
7373
public static GraphQLScalarType GraphQLString = new GraphQLScalarType("String", "Built-in String", new Coercing() {
7474
@Override
7575
public Object coerce(Object input) {
76-
return input.toString();
76+
return input == null ? null : input.toString();
7777
}
7878

7979
@Override

0 commit comments

Comments
 (0)