From c92148bd27c0186f34dd4e6df415c4a538da7a16 Mon Sep 17 00:00:00 2001 From: Laurent Andriamifidy Date: Wed, 24 Mar 2021 14:24:20 +0100 Subject: [PATCH] solved crash when expiry date index out of range --- gamestonk_terminal/options/op_controller.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gamestonk_terminal/options/op_controller.py b/gamestonk_terminal/options/op_controller.py index a093d015bfb..97f78740ae3 100644 --- a/gamestonk_terminal/options/op_controller.py +++ b/gamestonk_terminal/options/op_controller.py @@ -126,10 +126,15 @@ class OptionsController: process_input = an_input if process_input is not None: - self.__set_exp_date(int(an_input)) - print(f"\nNew selected expiry date : [{self.expiry_date}]\n") - return - # menu(self.ticker, self) + try: + self.__set_exp_date(int(an_input)) + print(f"\nNew selected expiry date : [{self.expiry_date}]\n") + return + # menu(self.ticker, self) + except IndexError: + print( + f"\nSelection must be between [0 - {len(self.raw_data_options.options) - 1}]\n" + ) except SystemExit: print("The command selected doesn't exist\n")