From accc6c106ff5715342e05eff4d8e64742f8b4a13 Mon Sep 17 00:00:00 2001 From: johni0702 Date: Thu, 13 Aug 2015 11:07:26 +0200 Subject: [PATCH] Fix invalid key id crashing the game --- .../replaymod/gui/overlay/GuiReplayOverlay.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/crushedpixel/replaymod/gui/overlay/GuiReplayOverlay.java b/src/main/java/eu/crushedpixel/replaymod/gui/overlay/GuiReplayOverlay.java index 4aa4f9ca..6fff96d3 100755 --- a/src/main/java/eu/crushedpixel/replaymod/gui/overlay/GuiReplayOverlay.java +++ b/src/main/java/eu/crushedpixel/replaymod/gui/overlay/GuiReplayOverlay.java @@ -312,7 +312,13 @@ public class GuiReplayOverlay extends Gui { if(buttonY < maxButtonY || maxButtonY == -1) maxButtonY = buttonY; - GuiElement button = new GuiAdvancedButton(buttonX, buttonY, 20, 20, Keyboard.getKeyName(kb.getKeyCode()), new Runnable() { + String keyName = "???"; + try { + keyName = Keyboard.getKeyName(kb.getKeyCode()); + } catch (ArrayIndexOutOfBoundsException e) { + // Apparently windows likes to press strange keys, see https://www.replaymod.com/forum/thread/55 + } + GuiElement button = new GuiAdvancedButton(buttonX, buttonY, 20, 20, keyName, new Runnable() { @Override public void run() { ReplayMod.keyInputHandler.handleCustomKeybindings(kb, false, kb.getKeyCode());