Fileman fit and finish

This commit is contained in:
Kyle Reed 2023-05-03 13:13:15 -07:00
parent 2f343adf21
commit c6316f5aa6
5 changed files with 93 additions and 42 deletions

View file

@ -163,6 +163,8 @@ void MenuView::clear() {
}
menu_items.clear();
highlighted_item = 0;
offset = 0;
}
void MenuView::add_item(MenuItem new_item) {
@ -209,7 +211,7 @@ MenuItemView* MenuView::item_view(size_t index) const {
bool MenuView::set_highlighted(int32_t new_value) {
int32_t item_count = (int32_t)menu_items.size();
if (new_value < 0)
if (new_value < 0 || item_count == 0)
return false;
if (new_value >= item_count)