Handle Empty or Non-Integer Input Gracefully in Option Selection
Xeno852 opened this issue · 1 comments
Xeno852 commented
There's an issue in the main menu option selection where pressing enter without inputting a value or inputting a non-integer value causes the program to crash with a ValueError. This happens because the program attempts to convert an empty string or a non-integer input directly to an integer without validation. The expected behavior would be for the program to prompt the user again for input until a valid integer that corresponds to one of the options is provided.
Steps to Reproduce:
- Run the program and reach the main menu.
- Press enter without typing anything or enter a non-integer value.
Expected Result:
- The program should display an error message indicating the input is invalid and prompt for input again.
Actual Result:
- The program crashes with a ValueError.
This issue could be fixed by adding a loop that validates the input before attempting to convert it to an integer, ensuring robust input handling.
FujiwaraChoki commented
Well done!