aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author2stinkysocks <54291521+2stinkysocks@users.noreply.github.com>2022-05-08 09:19:53 -0700
committerGitHub <noreply@github.com>2022-05-08 18:19:53 +0200
commit8cb323ffe9cc0a0de6572695a5562bed3db8956e (patch)
treef72de88152749d58ecf5e2d47ff86bb0eb1e310a
parent0d194f9596525b973e4da1fa6f86dac9accf6a52 (diff)
downloadNotEnoughUpdates-8cb323ffe9cc0a0de6572695a5562bed3db8956e.tar.gz
NotEnoughUpdates-8cb323ffe9cc0a0de6572695a5562bed3db8956e.tar.bz2
NotEnoughUpdates-8cb323ffe9cc0a0de6572695a5562bed3db8956e.zip
fix an npe in my last pr (#134)
* fix npe * i did not forget to remove println
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CookieWarning.java9
1 files 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;
}
- }
+ }
}
}
}