You've already forked Arcturus-Morningstar-Extended
mirror of
https://github.com/duckietm/Arcturus-Morningstar-Extended.git
synced 2026-06-19 15:06:19 +00:00
Safely handle JsonNull types
This commit is contained in:
@@ -109,13 +109,13 @@ public class FurnidataReader {
|
|||||||
JsonArray types = sectionObj.getAsJsonArray("furnitype");
|
JsonArray types = sectionObj.getAsJsonArray("furnitype");
|
||||||
for (JsonElement el : types) {
|
for (JsonElement el : types) {
|
||||||
JsonObject o = el.getAsJsonObject();
|
JsonObject o = el.getAsJsonObject();
|
||||||
if (!o.has("id") || !o.has("classname")) continue;
|
if (!o.has("id") || o.get("id").isJsonNull() || !o.has("classname") || o.get("classname").isJsonNull()) continue;
|
||||||
out.add(new FurnidataEntry(
|
out.add(new FurnidataEntry(
|
||||||
o.get("id").getAsInt(),
|
o.get("id").getAsInt(),
|
||||||
o.get("classname").getAsString(),
|
o.get("classname").getAsString(),
|
||||||
type,
|
type,
|
||||||
o.has("name") ? o.get("name").getAsString() : "",
|
(o.has("name") && !o.get("name").isJsonNull()) ? o.get("name").getAsString() : "",
|
||||||
o.has("description") ? o.get("description").getAsString() : ""
|
(o.has("description") && !o.get("description").isJsonNull()) ? o.get("description").getAsString() : ""
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user