From 75446f682aafe9a62d7bd91dd79b6de6eef22fcd Mon Sep 17 00:00:00 2001 From: Tristan Rowley Date: Thu, 12 Mar 2020 22:02:42 +0000 Subject: [PATCH] Show error when trying to fast-switch page that isn't there --- user_input/numpad_input.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/user_input/numpad_input.py b/user_input/numpad_input.py index 634de81..37f1156 100644 --- a/user_input/numpad_input.py +++ b/user_input/numpad_input.py @@ -76,7 +76,10 @@ class NumpadInput(object): numbers = "jklmnopqrs" if self.data.is_display_held and key in numbers: - return self.actions.call_method_name("set_display_mode_%s"%self.data.get_display_modes_list()[numbers.index(key)]) + if numbers.index(key) >= len(self.data.get_display_modes_list()): + self.message_handler.set_message('ERROR', 'No page %s to display!' % numbers.index(key)) + return + self.actions.call_method_name("set_display_mode_%s"%self.data.get_display_modes_list()[numbers.index(key)]) print('the numpad action being called is {} (mode is {})'.format(this_mapping[mode][is_function], mode)) if value != -1: