mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2026-08-01 14:19:12 -06:00
Fix: Add a check to the index
This fixes some mods like galacticraft trying to get unexisting keyboard keys
This commit is contained in:
parent
804d349b2e
commit
b98c012c29
1 changed files with 4 additions and 3 deletions
|
|
@ -393,9 +393,10 @@ public class Keyboard {
|
|||
* @return true if the key is down according to the last poll()
|
||||
*/
|
||||
public static boolean isKeyDown(int key) {
|
||||
if (!created)
|
||||
throw new IllegalStateException("Keyboard must be created before you can query key state");
|
||||
return keyDownBuffer.get(key) != 0;
|
||||
if (!created)
|
||||
throw new IllegalStateException("Keyboard must be created before you can query key state");
|
||||
if(key >= KEYBOARD_SIZE) return false;
|
||||
return keyDownBuffer.get(key) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue