From 29bc3371a62a74d2eab4fe9b6d5c820d52dbbac4 Mon Sep 17 00:00:00 2001 From: Lulonaut Date: Mon, 26 Sep 2022 08:42:51 +0200 Subject: [PATCH] Fix TextTabOverlay crash (#308) --- .../notenoughupdates/overlays/TextTabOverlay.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java index 03578c95dc..fa263db725 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TextTabOverlay.java @@ -49,8 +49,13 @@ public void tick() { public void realTick() { shouldUpdateOverlay = shouldUpdate(); if (shouldUpdateOverlay) { - boolean currentTabState = - Keyboard.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode()); + int keycode = Minecraft.getMinecraft().gameSettings.keyBindPlayerList.getKeyCode(); + boolean currentTabState; + if (keycode > 0) { + currentTabState = Keyboard.isKeyDown(keycode); + } else { + currentTabState = false; + } if (lastTabState != currentTabState) { lastTabState = currentTabState; update();