Skip to content

Commit

Permalink
fix: add exception handling for vanilla key bindings
Browse files Browse the repository at this point in the history
fixes #183
  • Loading branch information
ACGaming authored Apr 10, 2024
1 parent ff4ebbe commit acec442
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,16 @@ public void keyTick(Type type, boolean tickEnd)
int keyCode = keyBinding.getKeyCode();
if (keyCode == Keyboard.KEY_NONE)
continue;
boolean state = keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode);
boolean state;
try
{
state = keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode);
} catch (IndexOutOfBoundsException e)
{
GalacticraftCore.logger.error("Invalid keybinding! " + keyBinding.getKeyDescription());
continue;
}

if (state != this.keyDown[i + this.keyBindings.length] || state && this.vRepeatings[i])
{
if (state)
Expand Down

0 comments on commit acec442

Please sign in to comment.