Repository: smallrye/smallrye-graphql
Issue: Typesafe Client: JsonException when a GraphQL error has a path that is actually `null`

```json
{
  "errors": [
    {
      "message": "some error message",
      "locations": [{"line": 1, "column": 256}],
      "path": ["foo", "bar", "baz"],
    }
  ],
  "data": {
    "foo": [
      {
        "bar": null,
      }
    ]
  }
}
```

There was an error in `foo/bar/baz` that resulted in `foo/bar` being `null`.

⇒ The typesafe client fails with `javax.json.JsonException: The reference value in a JSON Pointer must be a JSON Object or a JSON Array, was 'NULL'` in `ResultBuilder` line 74 when trying to apply an `ErrorOr`.

Expected: don't apply the `ErrorOr`

Changed files:
client/tck/src/main/java/tck/graphql/typesafe/ErrorBehavior.java
client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/ResultBuilder.java

diff --git a/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/ResultBuilder.java b/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/ResultBuilder.java
index c4e14be5..dbf0cbbf 100644
--- a/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/ResultBuilder.java
+++ b/client/implementation/src/main/java/io/smallrye/graphql/client/typesafe/impl/ResultBuilder.java
@@ -13,6 +13,7 @@ import java.util.stream.Collectors;
 import javax.json.Json;
 import javax.json.JsonArray;
 import javax.json.JsonArrayBuilder;
+import javax.json.JsonException;
 import javax.json.JsonObject;
 import javax.json.JsonPatch;
 import javax.json.JsonPointer;
@@ -72,6 +73,8 @@ public class ResultBuilder {
         if (data == null || path == null)
             return false;
         JsonPointer pointer = Json.createPointer(path.stream().map(Object::toString).collect(joining("/", "/", "")));
+        if (!exists(pointer))
+            return false;
         JsonArrayBuilder errors = Json.createArrayBuilder();
         if (pointer.containsValue(data) && isListOf(pointer.getValue(data), ErrorOr.class.getSimpleName()))
             pointer.getValue(data).asJsonArray().forEach(errors::add);
@@ -80,6 +83,15 @@ public class ResultBuilder {
         return true;
     }
 
+    private boolean exists(JsonPointer pointer) {
+        try {
+            pointer.containsValue(data);
+            return true;
+        } catch (JsonException e) {
+            return false;
+        }
+    }
+
     private GraphQLClientError convert(JsonValue jsonValue) {
         JsonObject jsonObject = jsonValue.asJsonObject();
         return new GraphQLClientError() {
diff --git a/client/tck/src/main/java/tck/graphql/typesafe/ErrorBehavior.java b/client/tck/src/main/java/tck/graphql/typesafe/ErrorBehavior.java
index 1660660a..beea0c32 100644
--- a/client/tck/src/main/java/tck/graphql/typesafe/ErrorBehavior.java
+++ b/client/tck/src/main/java/tck/graphql/typesafe/ErrorBehavior.java
@@ -458,6 +458,34 @@ class ErrorBehavior {
         then(error.getErrorCode()).isEqualTo("team-search-disabled");
     }
 
+    @Test
+    void shouldFetchErrorOrWithNullInPath() {
+        fixture.returns("{" +
+                "\\"data\\":{\\"teams\\":null}," +
+                "\\"errors\\":[{" +
+                /**/"\\"message\\":\\"can't get team name\\"," +
+                /**/"\\"locations\\":[{\\"line\\":1,\\"column\\":2,\\"sourceName\\":\\"loc\\"}]," +
+                /**/"\\"path\\": [\\"teams\\",\\"name\\"],\\n" +
+                /**/"\\"extensions\\":{" +
+                /**//**/"\\"code\\":\\"team-name-disabled\\"}" +
+                "}]}}");
+        SuperHeroApi api = fixture.build(SuperHeroApi.class);
+
+        GraphQLClientException throwable = catchThrowableOfType(api::teams, GraphQLClientException.class);
+
+        then(fixture.query()).isEqualTo("query teams { teams {name} }");
+        then(throwable).hasMessage("errors from service");
+        then(throwable).hasToString("GraphQlClientException: errors from service\\n" +
+                "errors:\\n" +
+                "- team-name-disabled: [teams, name] can't get team name [(1:2@loc)] {code=team-name-disabled})");
+        then(throwable.getErrors()).hasSize(1);
+        GraphQLClientError error = throwable.getErrors().get(0);
+        then(error.getMessage()).isEqualTo("can't get team name");
+        then(error.getPath()).containsExactly("teams", "name");
+        then(error.getLocations()).containsExactly(new SourceLocation(1, 2, "loc"));
+        then(error.getErrorCode()).isEqualTo("team-name-disabled");
+    }
+
     static class Wrapper {
         @Name("findHeroes")
         List<ErrorOr<SuperHero>> superHeroes;