Skip to content

Commit

Permalink
Fix[keyboard]: handle OOB keyDown requests
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias-Boulay committed Oct 18, 2023
1 parent 0873acf commit 22aa25c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ private static void read() {
public static boolean isKeyDown(int key) {
if (!created)
throw new IllegalStateException("Keyboard must be created before you can query key state");
if(key >= KEYBOARD_SIZE) return false;
if(key < 0 || key >= keyDownBuffer.limit()) return false;
return keyDownBuffer.get(key) != 0;
}

Expand Down

0 comments on commit 22aa25c

Please sign in to comment.