Skip to content

Commit

Permalink
fix: crash when a script menu update renders selected index unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
po5 committed Jul 25, 2023
1 parent 72982e2 commit 1620513
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/uosc/elements/Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ function Menu:update_dimensions()
menu.top = round(math.max((display.height - menu.height) / 2, title_height * 1.5))
menu.scroll_height = math.max(content_height - menu.height - self.item_spacing, 0)
menu.scroll_y = menu.scroll_y or 0
if menu.selected_index then
menu.selected_index = clamp(1, menu.selected_index, #menu.items)
end
self:scroll_to(menu.scroll_y, menu) -- clamps scroll_y to scroll limits
end

Expand Down

0 comments on commit 1620513

Please sign in to comment.