mirror of
https://github.com/coding-horror/basic-computer-games.git
synced 2025-12-29 14:15:08 -08:00
Merge pull request #794 from posguy99/superstartrek_python_fix
add try/except to computer prompt, invalid input should not crash game
This commit is contained in:
@@ -902,7 +902,10 @@ class Game:
|
||||
if len(command) == 0:
|
||||
com = 6
|
||||
else:
|
||||
com = int(command)
|
||||
try:
|
||||
com = int(command)
|
||||
except ValueError:
|
||||
com = 6
|
||||
if com < 0:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user