Skip to content

Commit c79a430

Browse files
committed
Handle when no choices available in list_input
1 parent e6e0502 commit c79a430

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

displayer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ def list_input(input_string: str, choices: list, displayer: Callable,
9595
"""Allows the player to choose from a certain list of options. Includes validation."""
9696
if extra_allowables is None:
9797
extra_allowables = []
98-
if len(choices) + len(extra_allowables) == 0:
98+
valid_choices = [choice for choice in choices if validator(choice)] + extra_allowables
99+
if len(valid_choices) == 0:
99100
ansiprint("<red>There are no valid choices.</red>")
100101
return None
101102
# Automatically choose the only option if there is only one

0 commit comments

Comments
 (0)