]> gerrit.simantics Code Review - simantics/platform.git/commitdiff
Prevent NPE in JsonUtils.readPossibleVariableUri 27/3727/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 19 Dec 2019 11:08:53 +0000 (13:08 +0200)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Thu, 19 Dec 2019 11:08:53 +0000 (13:08 +0200)
Previously NPE could come if the input JSON contained e.g. array values.

gitlab #331

Change-Id: I0b4c5134de12685414716ff9cef479d48cabd8ba

bundles/org.simantics.charts/src/org/simantics/charts/internal/JsonUtils.java

index 19d9d48430d6109bf18acb930d15774b0a41e050..49bc6f08d40f41c109fa40abd25376a771f244b7 100644 (file)
@@ -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")) {