From b2cd8f5b1564eebe3fbcc6c26c1a3fd296a819b4 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Tue, 4 Oct 2022 08:20:27 +0200 Subject: fixed crash because of key binding --- src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt index 80b0031e9..3819573c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt @@ -29,7 +29,13 @@ object OSUtils { fun KeyBinding.isActive() : Boolean { if (!Keyboard.isCreated()) return false - if (Keyboard.isKeyDown(this.keyCode)) return true + try { + if (Keyboard.isKeyDown(this.keyCode)) return true + } catch (e: IndexOutOfBoundsException) { + println("KeyBinding isActive caused an IndexOutOfBoundsException with keyCode: $keyCode") + e.printStackTrace() + return false + } if (this.isKeyDown || this.isPressed) return true return false } -- cgit