From c45ab5ad852f09f7f6689cf67aca2f02bc31deeb Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Tue, 24 Feb 2015 02:46:55 +0100
Subject: [PATCH] Server/py: Add value check to command_turn().

---
 plomrogue-server.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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.
-- 
2.30.2