Bugfix keyCode bigger than mapped numKeys inside keyEvent method #128
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
for some strange unknown reasons the method keyEvent inside of ControlWindow recieves a keyCode which cannot be handled by the keys boolean array of a size of only 1024. Then this error message is thrown and the application freeze.
java.lang.ArrayIndexOutOfBoundsException: 61443
at controlP5.ControlWindow.keyEvent(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at processing.core.PApplet$RegisteredMethods.handle(PApplet.java:1408)
at processing.core.PApplet.handleMethods(PApplet.java:1610)
at processing.core.PApplet.handleKeyEvent(PApplet.java:2946)
at processing.core.PApplet.dequeueEvents(PApplet.java:2599)
at processing.core.PApplet.handleDraw(PApplet.java:2437)
at processing.awt.PSurfaceAWT$12.callDraw(PSurfaceAWT.java:1557)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:316)
My approach was to check for the keyCode if it is bigger than numKeys (bigger than 1024) and exit the method if true. Maybe this is just a workaround and you have a better idea?! Anyway it fixed the bug.