From 193c0c8acd7dfefadd496b50ce2ecf2ff12a35f7 Mon Sep 17 00:00:00 2001 From: jani270 <69345714+jani270@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:13:43 +0100 Subject: Fixed another rift page crash (#992) --- .../notenoughupdates/profileviewer/rift/RiftPage.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') 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 62948b9b..93878bf0 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 @@ -124,6 +124,7 @@ public class RiftPage extends GuiProfileViewerPage { "rift.dead_cats", new JsonObject() ).getAsJsonObject(); + if (deadCats != null && !deadCats.entrySet().isEmpty() && deadCats.has("found_cats")) { JsonArray foundCats = Utils.getElementOrDefault( selectedProfile.getProfileJson(), @@ -186,10 +187,11 @@ public class RiftPage extends GuiProfileViewerPage { } // Timecharms - - JsonObject gallery = riftData.getAsJsonObject("gallery"); - JsonArray timecharm = gallery.getAsJsonArray("secured_trophies"); - // 346, 16 + JsonArray timecharm = Utils.getElementOrDefault( + selectedProfile.getProfileJson(), + "rift.gallery.secured_trophies", + new JsonArray() + ).getAsJsonArray(); if (timecharm != null) { Utils.renderAlignedString( @@ -208,7 +210,7 @@ public class RiftPage extends GuiProfileViewerPage { String timecharmType = jsonElement.getAsJsonObject().get("type").getAsString(); ItemStack timecharmItem = NotEnoughUpdates.INSTANCE.manager.createItemResolutionQuery().withKnownInternalName( "RIFT_TROPHY_" + timecharmType.toUpperCase()).resolveToItemStack(); - if(timecharmItem != null) { + if (timecharmItem != null) { displayNames.add(timecharmItem.getDisplayName() + "§7: §a✔"); } else { displayNames.add(EnumChatFormatting.RED.toString() + EnumChatFormatting.BOLD + "ERROR LOADING TIMECHARM!"); -- cgit