From cabff9ab86edf70392d1337b05d8c1c3c751478d Mon Sep 17 00:00:00 2001 From: frankiezafe Date: Mon, 11 Jun 2018 11:53:40 +0200 Subject: [PATCH] quick fix on ListBox:onRelease index out of range error --- src/controlP5/ListBox.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/controlP5/ListBox.java b/src/controlP5/ListBox.java index 57c8a05..62da490 100755 --- a/src/controlP5/ListBox.java +++ b/src/controlP5/ListBox.java @@ -128,9 +128,14 @@ public class ListBox extends Controller< ListBox > implements ControlListener { } else if ( isOpen ) { double n = Math.floor( ( getPointer( ).y( ) - barHeight ) / itemHeight ); - + // n += itemRange; /* UP */ int index = ( int ) n + itemIndexOffset; + + if ( index < 0 || index >= items.size() ) { + // no need to go further, there is something wrong in the position process + return; + } Map m = items.get( index );