aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-04 08:20:27 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2022-10-04 08:20:27 +0200
commitb2cd8f5b1564eebe3fbcc6c26c1a3fd296a819b4 (patch)
tree8b31d8c592f71645361fd7858448a638d4c68636 /src/main
parent14b55844e3b7df9e9c1f625b4a10da64cb434f53 (diff)
downloadskyhanni-b2cd8f5b1564eebe3fbcc6c26c1a3fd296a819b4.tar.gz
skyhanni-b2cd8f5b1564eebe3fbcc6c26c1a3fd296a819b4.tar.bz2
skyhanni-b2cd8f5b1564eebe3fbcc6c26c1a3fd296a819b4.zip
fixed crash because of key binding
Diffstat (limited to 'src/main')
-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
}