solved crash when expiry date index out of range

This commit is contained in:
Laurent Andriamifidy
2021-03-24 14:24:20 +01:00
parent 85f8acb2c7
commit c92148bd27

View File

@@ -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")