handle null when reading JsonString

This commit is contained in:
Grahame Grieve 2020-02-22 07:59:42 +11:00
parent fe84d9ef42
commit 550aeffb9a
1 changed files with 1 additions and 1 deletions

View File

@ -86,7 +86,7 @@ public class JSONUtil {
JsonElement e = json.get(name1);
if (e == null)
e = json.get(name2);
return e == null ? null : e.getAsString();
return e == null ? null : e instanceof JsonNull ? null : e.getAsString();
}
public static boolean has(JsonObject json, String name1, String name2) {