Don't select last item when clicking past the end of the panel.

This commit is contained in:
Hisham Muhammad 2015-08-27 19:14:25 -03:00
parent 6082db2121
commit 3c4326b450
1 changed files with 4 additions and 1 deletions

View File

@ -254,7 +254,10 @@ int Panel_size(Panel* this) {
void Panel_setSelected(Panel* this, int selected) {
assert (this != NULL);
selected = MIN(Vector_size(this->items) - 1, selected);
int size = Vector_size(this->items);
if (selected >= size) {
return;
}
if (selected < 0)
selected = 0;
this->selected = selected;