diff options
2 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java index d64f54c1..11e291b0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/EssenceTaskLevel.java @@ -94,7 +94,9 @@ public class EssenceTaskLevel { .resolveToItemListJson() .get("displayname") .getAsString(); - value.max = essenceShopTask.get(key.toLowerCase() + "_shop").getAsInt(); + String name = key.toLowerCase() + "_shop"; + if (!essenceShopTask.has(name)) continue; + value.max = essenceShopTask.get(name).getAsInt(); lore.add(levelPage.buildLore( EnumChatFormatting.getTextWithoutFormattingCodes(value.name), value.current, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java index a717664d..e0ea89b3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/level/task/MiscTaskLevel.java @@ -116,17 +116,18 @@ public class MiscTaskLevel { JsonObject communityShopUpgradesMax = miscellaneousTask.getAsJsonObject("community_shop_upgrades_max"); int communityShopUpgradesXp = miscellaneousTask.get("community_shop_upgrades_xp").getAsInt(); - - for ( - JsonElement upgradeState : upgradeStates) { - if (!upgradeState.isJsonObject()) continue; - JsonObject value = upgradeState.getAsJsonObject(); - String upgrade = value.get("upgrade").getAsString(); - int tier = value.get("tier").getAsInt(); - if (communityShopUpgradesMax.has(upgrade)) { - int max = communityShopUpgradesMax.get(upgrade).getAsInt(); - if (max >= tier) { - sbXpCommunityUpgrade += communityShopUpgradesXp; + if (upgradeStates != null) { + for ( + JsonElement upgradeState : upgradeStates) { + if (!upgradeState.isJsonObject()) continue; + JsonObject value = upgradeState.getAsJsonObject(); + String upgrade = value.get("upgrade").getAsString(); + int tier = value.get("tier").getAsInt(); + if (communityShopUpgradesMax.has(upgrade)) { + int max = communityShopUpgradesMax.get(upgrade).getAsInt(); + if (max >= tier) { + sbXpCommunityUpgrade += communityShopUpgradesXp; + } } } } |