From 2c58c09f12eb4cceeacbb31fcca4804198be140b Mon Sep 17 00:00:00 2001 From: efefury <69400149+efefury@users.noreply.github.com> Date: Sun, 23 Jul 2023 12:43:51 +0200 Subject: fixed several crashes in pv (#784) --- .../moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java | 2 ++ .../github/moulberry/notenoughupdates/profileviewer/rift/RiftPage.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java index 38e26a80..ef4d5aa9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewerUtils.java @@ -29,6 +29,7 @@ import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.JsonUtils; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.JsonToNBT; @@ -242,6 +243,7 @@ public class ProfileViewerUtils { } public static ItemStack getPlayerData(String username) { + if (username == null) return new ItemStack(Blocks.stone); String nameLower = username.toLowerCase(); if (!playerSkullCache.containsKey(nameLower)) { playerSkullCache.put(nameLower, fallBackSkull()); 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 0f2c4856..bff6834c 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 @@ -121,7 +121,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()) { + if (!deadCats.entrySet().isEmpty() && deadCats.has("found_cata")) { JsonArray foundCats = deadCats.getAsJsonArray("found_cats"); int size = foundCats.size(); -- cgit