Skip to content

Commit a4a70c4

Browse files
committed
ensure DFEImpl graphql context is never null
1 parent 5461998 commit a4a70c4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/graphql/schema/DataFetchingEnvironmentImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
import com.google.common.collect.ImmutableMap;
5+
import graphql.Assert;
56
import graphql.GraphQLContext;
67
import graphql.Internal;
78
import graphql.collect.ImmutableKit;
@@ -60,7 +61,7 @@ private DataFetchingEnvironmentImpl(Builder builder) {
6061
this.source = builder.source;
6162
this.arguments = builder.arguments == null ? ImmutableKit::emptyMap : builder.arguments;
6263
this.context = builder.context;
63-
this.graphQLContext = builder.graphQLContext;
64+
this.graphQLContext = Assert.assertNotNull(builder.graphQLContext);
6465
this.localContext = builder.localContext;
6566
this.root = builder.root;
6667
this.fieldDefinition = builder.fieldDefinition;
@@ -266,7 +267,7 @@ public static class Builder {
266267

267268
private Object source;
268269
private Object context;
269-
private GraphQLContext graphQLContext;
270+
private GraphQLContext graphQLContext = GraphQLContext.newContext().build();
270271
private Object localContext;
271272
private Object root;
272273
private GraphQLFieldDefinition fieldDefinition;

0 commit comments

Comments
 (0)