From 40e55b700dbf1fabb7aac5f3b969d65765353418 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 19 Feb 2015 13:02:52 +0100
Subject: [PATCH] Server/py: Catch shlex tokenizer ValueError exceptions in
 obey().

---
 plomrogue-server.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/plomrogue-server.py b/plomrogue-server.py
index dfae044..7a56d55 100755
--- a/plomrogue-server.py
+++ b/plomrogue-server.py
@@ -53,7 +53,11 @@ def detect_atomic_leftover(path):
 def obey(cmd, io_db, path_recordfile):
     """"""
     print("Input: " + cmd)
-    tokens = shlex.split(cmd, comments=True)
+    try:
+        tokens = shlex.split(cmd, comments=True)
+    except ValueError as err:
+        print("Can't tokenize command string: " + str(err) + ".")
+        return
     if 0 == len(tokens):
         pass
     elif "PING" == tokens[0] and 1 == len(tokens):
-- 
2.30.2