From e464f30445b798873f594d96a022e1816befb368 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 27 Feb 2024 13:48:21 -0500 Subject: [PATCH] Parsing grants --- src/engine/objects/ItemTemplate.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index 322a8ef7..16b4972c 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -279,12 +279,14 @@ public class ItemTemplate { } JSONArray powerGrants = (JSONArray) jsonObject.get("item_power_grant"); - for (Object o : powerGrants) { - JSONObject powerGrantEntry = (JSONObject) o; - String power_type = (String) powerGrantEntry.get("power_type"); - int power_value = ((Long) powerGrantEntry.get("power_value")).intValue(); - item_power_grant.put(power_type, power_value); - } + + if (powerGrants.isEmpty() == false) + for (Object o : powerGrants) { + JSONObject powerGrantEntry = (JSONObject) o; + String power_type = (String) powerGrantEntry.get("power_type"); + int power_value = ((Long) powerGrantEntry.get("power_value")).intValue(); + item_power_grant.put(power_type, power_value); + } } catch (Exception e) {