mirror of
https://github.com/sojamo/controlp5
synced 2024-11-22 05:57:57 +01:00
quick fix on ListBox:onRelease index out of range error
This commit is contained in:
parent
1f7cb64986
commit
cabff9ab86
@ -128,9 +128,14 @@ public class ListBox extends Controller< ListBox > implements ControlListener {
|
|||||||
} else if ( isOpen ) {
|
} else if ( isOpen ) {
|
||||||
|
|
||||||
double n = Math.floor( ( getPointer( ).y( ) - barHeight ) / itemHeight );
|
double n = Math.floor( ( getPointer( ).y( ) - barHeight ) / itemHeight );
|
||||||
|
|
||||||
// n += itemRange; /* UP */
|
// n += itemRange; /* UP */
|
||||||
int index = ( int ) n + itemIndexOffset;
|
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 );
|
Map m = items.get( index );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user