From d4d57f5160567a67fe2cea84bb08a4b232f8e955 Mon Sep 17 00:00:00 2001 From: Tuukka Lehtonen Date: Thu, 19 Dec 2019 13:08:53 +0200 Subject: [PATCH] Prevent NPE in JsonUtils.readPossibleVariableUri Previously NPE could come if the input JSON contained e.g. array values. gitlab #331 Change-Id: I0b4c5134de12685414716ff9cef479d48cabd8ba --- .../src/org/simantics/charts/internal/JsonUtils.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java b/bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java index 19d9d4843..49bc6f08d 100644 --- a/bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java +++ b/bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java @@ -54,6 +54,9 @@ public class JsonUtils { while (jp.nextToken() != JsonToken.END_OBJECT) { String fieldName = jp.getCurrentName(); jp.nextToken(); + if (fieldName == null) + continue; + if (fieldName.equals("uri")) { uri = jp.getValueAsString(); } else if (fieldName.equals("type")) { -- 2.47.1