From 494f38ea60ac68c3ce3dc6dd4c2110ac55cd5d85 Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Wed, 7 Sep 2022 14:25:17 -0400 Subject: [PATCH] fix(graphql) Fix null pointer exception when fetching entity aspects via graphql (#5857) --- .../datahub/graphql/WeaklyTypedAspectsResolver.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/WeaklyTypedAspectsResolver.java b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/WeaklyTypedAspectsResolver.java index e073725c43cc1..340cd15d02e8c 100644 --- a/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/WeaklyTypedAspectsResolver.java +++ b/datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/WeaklyTypedAspectsResolver.java @@ -74,12 +74,13 @@ public CompletableFuture> get(DataFetchingEnvironment environmen DataMap renderSpec = aspectSpec.getRenderSpec(); - AspectRenderSpec resultRenderSpec = new AspectRenderSpec(); - - resultRenderSpec.setDisplayType(renderSpec.getString("displayType")); - resultRenderSpec.setDisplayName(renderSpec.getString("displayName")); - resultRenderSpec.setKey(renderSpec.getString("key")); - result.setRenderSpec(resultRenderSpec); + if (renderSpec != null) { + AspectRenderSpec resultRenderSpec = new AspectRenderSpec(); + resultRenderSpec.setDisplayType(renderSpec.getString("displayType")); + resultRenderSpec.setDisplayName(renderSpec.getString("displayName")); + resultRenderSpec.setKey(renderSpec.getString("key")); + result.setRenderSpec(resultRenderSpec); + } results.add(result); } catch (IOException | RemoteInvocationException | URISyntaxException e) {