From: Christian Heller Date: Tue, 24 Feb 2015 01:46:55 +0000 (+0100) Subject: Server/py: Add value check to command_turn(). X-Git-Tag: tce~481 X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/%7B%7Bdb.prefix%7D%7D/%7B%7Bprefix%7D%7D?a=commitdiff_plain;h=c45ab5ad852f09f7f6689cf67aca2f02bc31deeb;p=plomrogue Server/py: Add value check to command_turn(). --- diff --git a/plomrogue-server.py b/plomrogue-server.py index 9e4f008..8d09550 100755 --- a/plomrogue-server.py +++ b/plomrogue-server.py @@ -252,7 +252,13 @@ def command_quit(): def command_turn(turn_string): """Set turn to what's described in turn_string.""" - world_db["TURN"] = int(turn_string) + try: + turn = int(turn_string) + if turn < 0 or turn > 65535: + raise ValueError + world_db["TURN"] = turn + except ValueError: + print("Ignoring: Argument must be integer >= 0 and <= 65535.") """Commands database.