diff --git a/addons/source-python/packages/source-python/menus/queue.py b/addons/source-python/packages/source-python/menus/queue.py index 3193ef2ac..746865912 100644 --- a/addons/source-python/packages/source-python/menus/queue.py +++ b/addons/source-python/packages/source-python/menus/queue.py @@ -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) diff --git a/addons/source-python/packages/source-python/menus/radio.py b/addons/source-python/packages/source-python/menus/radio.py index 1f2bff303..36344401b 100644 --- a/addons/source-python/packages/source-python/menus/radio.py +++ b/addons/source-python/packages/source-python/menus/radio.py @@ -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.