From: Tuukka Lehtonen Date: Thu, 19 Dec 2019 11:08:53 +0000 (+0200) Subject: Prevent NPE in JsonUtils.readPossibleVariableUri X-Git-Tag: v1.43.0~136^2~16 X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F27%2F3727%2F1;p=simantics%2Fplatform.git Prevent NPE in JsonUtils.readPossibleVariableUri Previously NPE could come if the input JSON contained e.g. array values. gitlab #331 Change-Id: I0b4c5134de12685414716ff9cef479d48cabd8ba --- 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")) {