aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/OSUtils.kt8
1 files changed, 7 insertions, 1 deletions
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
}