Skip to content

Commit

Permalink
Fixed some errors related to menus. (#487)
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanbriere committed Jul 18, 2023
1 parent f129713 commit f3272be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion addons/source-python/packages/source-python/menus/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def _validate_selection(command, index, valid_choices):
"""
try:
choice = int(command[1])
except ValueError:
except (ValueError, IndexError):
# Catch errors caused by e.g. "menuselect a"
return (None, None)

Expand Down
9 changes: 6 additions & 3 deletions addons/source-python/packages/source-python/menus/radio.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,12 @@ def _select(self, player_index, choice_index):
if choice_index == BUTTON_CLOSE:
return self._select_close(player_index)

return super()._select(
player_index,
self._player_pages[player_index].options[choice_index])
try:
option = self._player_pages[player_index].options[choice_index]
except KeyError:
return

return super()._select(player_index, option)

def _send(self, player_index):
"""Build and sends the menu to the given player via ShowMenu.
Expand Down

0 comments on commit f3272be

Please sign in to comment.