Fix to Issue #40

Added check if index is in range before using it to index the list of
items.
This commit is contained in:
James Morrow 2016-01-05 19:20:25 -07:00
parent 665b0c1aa5
commit 9eedf3ad45

View File

@ -127,6 +127,7 @@ public class DropdownList extends Controller< DropdownList > implements ControlL
// n += itemRange; /* UP */ // n += itemRange; /* UP */
int index = ( int ) n + itemIndexOffset; int index = ( int ) n + itemIndexOffset;
if (index < items.size()) {
Map m = items.get( index ); Map m = items.get( index );
switch ( _myType ) { switch ( _myType ) {
@ -146,6 +147,7 @@ public class DropdownList extends Controller< DropdownList > implements ControlL
m.put( "state" , !ControlP5.b( m.get( "state" ) ) ); m.put( "state" , !ControlP5.b( m.get( "state" ) ) );
break; break;
} }
}
} }
} }