Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkpcyrd <git@rxv.cc>2021-03-30 16:12:52 +0200
committerkpcyrd <git@rxv.cc>2021-03-30 16:12:52 +0200
commit82342a0e94ed6d591b9855db590719764e9cb460 (patch)
treeffd9a89a1dcf58528ec9e19591efe555a8c7eef0
parentbb5caf70b7c3daae863778738775823a51b0b92b (diff)
Add range check to generic_select
-rw-r--r--archinstall/lib/user_interaction.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/archinstall/lib/user_interaction.py b/archinstall/lib/user_interaction.py
index defc2cfc..b3e0b665 100644
--- a/archinstall/lib/user_interaction.py
+++ b/archinstall/lib/user_interaction.py
@@ -170,7 +170,10 @@ def generic_select(options, input_text="Select one of the above by index or abso
if len(selected_option.strip()) <= 0:
return None
elif selected_option.isdigit():
- selected_option = options[int(selected_option)]
+ selected_option = int(selected_option)
+ if selected_option >= len(options):
+ raise RequirementError(f'Selected option "{selected_option}" is out of range')
+ selected_option = options[selected_option]
elif selected_option in options:
pass # We gave a correct absolute value
else: