Respect that playerInput can be none

This commit is contained in:
Sebastian Lohff 2013-12-08 00:56:37 +01:00
parent 7a8a7ab16a
commit ea8254c68e
1 changed files with 12 additions and 11 deletions

View File

@ -73,19 +73,20 @@ if __name__ == '__main__':
# create and start input threads
print(config["playerInput"])
inputs = []
for playerInput in config["playerInput"]:
args = playerInput.get("Args", [])
if args is None:
args = []
if config["playerInput"] is not None:
for playerInput in config["playerInput"]:
args = playerInput.get("Args", [])
if args is None:
args = []
try:
inp = get_input(playerInput["Type"], args, app)
inputs.append(inp)
except InputException as e:
print("Error: %s" % e, file=sys.stderr)
sys.exit(1)
try:
inp = get_input(playerInput["Type"], args, app)
inputs.append(inp)
except InputException as e:
print("Error: %s" % e, file=sys.stderr)
sys.exit(1)
inputs[-1].start()
inputs[-1].start()
# create board
board = SeopardyGame(questions, gamestate)