From 6f0cb0037a93f8a065018862b285f1a46103bf10 Mon Sep 17 00:00:00 2001 From: DarkKronicle Date: Sat, 17 Sep 2022 21:18:00 -0600 Subject: [PATCH] Hot fix for stuff --- .../io/github/darkkronicle/kronhud/gui/AbstractHudEntry.java | 3 +++ .../io/github/darkkronicle/kronhud/gui/hud/KeystrokeHud.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/src/main/java/io/github/darkkronicle/kronhud/gui/AbstractHudEntry.java b/src/main/java/io/github/darkkronicle/kronhud/gui/AbstractHudEntry.java index 46a6c5a..06dc71b 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/gui/AbstractHudEntry.java +++ b/src/main/java/io/github/darkkronicle/kronhud/gui/AbstractHudEntry.java @@ -145,6 +145,9 @@ public DrawPosition getScaledPos() { } public DrawPosition getScaledPos(float scale) { + if (client.getWindow() == null) { + return new DrawPosition(0, 0); + } int scaledX = floatToInt((float) x.getDoubleValue(), client.getWindow().getScaledWidth(), Math.round(width * scale)); int scaledY = floatToInt((float) y.getDoubleValue(), client.getWindow().getScaledHeight(), diff --git a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/KeystrokeHud.java b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/KeystrokeHud.java index ae4e547..18831a7 100644 --- a/src/main/java/io/github/darkkronicle/kronhud/gui/hud/KeystrokeHud.java +++ b/src/main/java/io/github/darkkronicle/kronhud/gui/hud/KeystrokeHud.java @@ -46,6 +46,11 @@ public static Optional getMouseKeyBindName(KeyBinding keyBinding) { } public void setKeystrokes() { + if (client.getWindow() == null) { + keystrokes = null; + return; + // Wait until render is called + } keystrokes = new ArrayList<>(); DrawPosition pos = getPos(); // LMB