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