Commit 3c4326b4 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

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

parent 6082db21
...@@ -254,7 +254,10 @@ int Panel_size(Panel* this) { ...@@ -254,7 +254,10 @@ int Panel_size(Panel* this) {
void Panel_setSelected(Panel* this, int selected) { void Panel_setSelected(Panel* this, int selected) {
assert (this != NULL); assert (this != NULL);
selected = MIN(Vector_size(this->items) - 1, selected); int size = Vector_size(this->items);
if (selected >= size) {
return;
}
if (selected < 0) if (selected < 0)
selected = 0; selected = 0;
this->selected = selected; this->selected = selected;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment