From 8cb323ffe9cc0a0de6572695a5562bed3db8956e Mon Sep 17 00:00:00 2001 From: 2stinkysocks <54291521+2stinkysocks@users.noreply.github.com> Date: Sun, 8 May 2022 09:19:53 -0700 Subject: fix an npe in my last pr (#134) * fix npe * i did not forget to remove println --- .../moulberry/notenoughupdates/miscfeatures/CookieWarning.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java index 41c2219a..0abd5216 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java @@ -34,7 +34,12 @@ public class CookieWarning { */ private void checkCookie() { if(!hasNotified && NotEnoughUpdates.INSTANCE.config.notifications.doBoosterNotif) { - String[] lines = ((AccessorGuiPlayerTabOverlay) Minecraft.getMinecraft().ingameGUI.getTabList()).getFooter().getUnformattedText().split("\n"); + String[] lines = {}; + try { + lines = ((AccessorGuiPlayerTabOverlay) Minecraft.getMinecraft().ingameGUI.getTabList()).getFooter().getUnformattedText().split("\n"); + } catch(NullPointerException e) { + return; // if the footer is null or somehow doesn't exist, stop + } boolean hasCookie = true; String timeLine = null; // the line that contains the cookie timer for(int i = 0; i < lines.length; i++) { @@ -89,7 +94,7 @@ public class CookieWarning { ), true, true); hasNotified = true; } - } + } } } } -- cgit