From bbd28010e53d55df926e34c071d743f11464c8af Mon Sep 17 00:00:00 2001 From: radionics Date: Thu, 12 Jul 2018 07:50:31 +0200 Subject: [PATCH] Bugfix keyCode bigger than mapped numKeys inside keyEvent method --- .gitignore | 2 ++ src/controlP5/ControlWindow.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/.gitignore b/.gitignore index 37752ba..fbecc77 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ .buildpath .classpath .project +.idea +pom.xml \ No newline at end of file diff --git a/src/controlP5/ControlWindow.java b/src/controlP5/ControlWindow.java index 968d172..b64b838 100755 --- a/src/controlP5/ControlWindow.java +++ b/src/controlP5/ControlWindow.java @@ -458,6 +458,11 @@ public final class ControlWindow { public void keyEvent( KeyEvent theKeyEvent ) { + if (theKeyEvent.getKeyCode() > numKeys) { + // Something is wrong, a key was typed which is not mapped! + return; + } + if ( theKeyEvent.getAction( ) == KeyEvent.PRESS ) { keys[ theKeyEvent.getKeyCode( ) ] = true; numOfActiveKeys++;