From 50a05c8c5789c22e60c7bd94e44a8cc4c29dbdd4 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 7 Mar 2019 12:21:36 +0100
Subject: [PATCH] Fix syntax error checking in quote search.

---
 plomlombot.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/plomlombot.py b/plomlombot.py
index 7f3d4e5..f46a0b1 100755
--- a/plomlombot.py
+++ b/plomlombot.py
@@ -214,13 +214,13 @@ def handle_command(command, argument, notice, target, session):
             tokens = []
         else:
             tokens = argument.split(" ")
-        if len(tokens) != 0:
-           if (len(tokens) == 1 and not tokens[0].isdigit()) or \
-               tokens[0] not in {"search", "offset-search"} or \
-               (tokens[0] == "offset-search" and
-                ((not len(tokens) > 2) or (not tokens[1].isdigit()))):
-                help()
-                return
+       if (len(tokens) == 1 and not tokens[0].isdigit()) or \
+          (tokens > 1 and
+           tokens[0] not in {"search", "offset-search"} or
+           (tokens[0] == "offset-search" and
+            ((not len(tokens) > 2) or (not tokens[1].isdigit())))):
+           help()
+           return
         if not os.access(session.quotesfile, os.F_OK):
             notice("no quotes available")
             return
-- 
2.30.2