diff options
Diffstat (limited to 'src/main/java/io')
3 files changed, 6 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java index d7eb6adb..8b8285c6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ExtraPage.java @@ -466,7 +466,7 @@ public class ExtraPage extends GuiProfileViewerPage { if (topKills == null) { topKills = new TreeMap<>(); - JsonObject stats = profileInfo.get("stats").getAsJsonObject(); + JsonObject stats = Utils.getElementOrDefault(profileInfo, "stats", new JsonObject()).getAsJsonObject(); for (Map.Entry<String, JsonElement> entry : stats.entrySet()) { if (entry.getKey().startsWith("kills_")) { if (entry.getValue().isJsonPrimitive()) { @@ -482,7 +482,7 @@ public class ExtraPage extends GuiProfileViewerPage { } if (topDeaths == null) { topDeaths = new TreeMap<>(); - JsonObject stats = profileInfo.get("stats").getAsJsonObject(); + JsonObject stats = Utils.getElementOrDefault(profileInfo, "stats", new JsonObject()).getAsJsonObject(); for (Map.Entry<String, JsonElement> entry : stats.entrySet()) { if (entry.getKey().startsWith("deaths_")) { if (entry.getValue().isJsonPrimitive()) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java index d2242f87..910f8595 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java @@ -120,7 +120,7 @@ public class RiftPage extends GuiProfileViewerPage { Utils.drawTexturedRect(guiLeft + 35, guiTop + 156, 20, 20, 0, 20 / 256f, 0, 20 / 256f, GL11.GL_NEAREST); JsonObject deadCats = riftData.getAsJsonObject("dead_cats"); - if (!deadCats.entrySet().isEmpty() && deadCats.has("found_cats")) { + if (deadCats != null && !deadCats.entrySet().isEmpty() && deadCats.has("found_cats")) { JsonArray foundCats = deadCats.getAsJsonArray("found_cats"); int size = foundCats.size(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java index fad950fb..340756d9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/trophy/TrophyFishPage.java @@ -167,7 +167,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { JsonObject stats = profileInformation.getAsJsonObject("stats"); int thunderKills = 0; - if (stats.has("kills_thunder")) { + if (stats != null && stats.has("kills_thunder")) { thunderKills = stats.getAsJsonObject().get("kills_thunder").getAsInt(); } ItemStack thunder_sc = NotEnoughUpdates.INSTANCE.manager.jsonToStack( @@ -185,7 +185,7 @@ public class TrophyFishPage extends GuiProfileViewerPage { ); Minecraft.getMinecraft().getRenderItem().renderItemIntoGUI(lord_jawbus_sc, guiLeft + 16, guiTop + 120); int jawbusKills = 0; - if (stats.has("kills_lord_jawbus")) { + if (stats != null && stats.has("kills_lord_jawbus")) { jawbusKills = stats.getAsJsonObject().get("kills_lord_jawbus").getAsInt(); } @@ -260,10 +260,9 @@ public class TrophyFishPage extends GuiProfileViewerPage { } } - if (!trophyObject.has("rewards")) return; int[] trophiesPerTier = getTrophiesPerTier(trophyObject); - JsonArray rewards = trophyObject.get("rewards").getAsJsonArray(); + JsonArray rewards = Utils.getElementOrDefault(selectedProfile.getProfileJson(), "trophy_fish.rewards", new JsonArray()).getAsJsonArray(); int i = 0; for (ItemStack itemStack : armorHelmets.keySet()) { RenderHelper.enableGUIStandardItemLighting(); |