Skip to content

Commit

Permalink
iOS Input catch exception for unknown keys from hardware keyboard (#6337
Browse files Browse the repository at this point in the history
)
  • Loading branch information
MrStahlfelge committed Dec 30, 2020
1 parent 710b727 commit 09c3c16
Showing 1 changed file with 9 additions and 2 deletions.
Expand Up @@ -699,7 +699,7 @@ public boolean onKey(UIKey key, boolean down) {
return false;
}

int keyCode = getGdxKeyCode(key.getKeyCode());
int keyCode = getGdxKeyCode(key);

if (keyCode != Keys.UNKNOWN)
synchronized (keyEvents) {
Expand Down Expand Up @@ -957,7 +957,14 @@ public float getGyroscopeZ() {
return 0;
}

protected int getGdxKeyCode(UIKeyboardHIDUsage keyCode) {
protected int getGdxKeyCode(UIKey key) {
UIKeyboardHIDUsage keyCode;
try {
keyCode = key.getKeyCode();
} catch (IllegalArgumentException e) {
return Keys.UNKNOWN;
}

switch (keyCode) {
case KeyboardA:
return Keys.A;
Expand Down

0 comments on commit 09c3c16

Please sign in to comment.