fix(palette): add bounds check to activate_selected
This commit is contained in:
parent
28e9d60c1a
commit
e022b0b2f8
1 changed files with 4 additions and 2 deletions
|
@ -188,8 +188,10 @@ pub fn State(ctx_type: type) type {
|
|||
const selected = self.selected orelse return;
|
||||
self.selected_active = true;
|
||||
const pos = selected + self.header_count;
|
||||
const button = self.menu.widgets.items[pos].widget.dynamic_cast(button_type) orelse return;
|
||||
button.opts.on_click(&button.opts.ctx, button);
|
||||
if (pos < self.menu.widgets.items.len) {
|
||||
const button = self.menu.widgets.items[pos].widget.dynamic_cast(button_type) orelse return;
|
||||
button.opts.on_click(&button.opts.ctx, button);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue