Browse Source

[fix] answers: don't crash when the query is an empty string

Alexandre Flament 4 years ago
parent
commit
4fa1290c11
1 changed files with 1 additions and 1 deletions
  1. 1 1
      searx/answerers/__init__.py

+ 1 - 1
searx/answerers/__init__.py

@@ -32,7 +32,7 @@ def ask(query):
     results = []
     query_parts = list(filter(None, query.query.split()))
 
-    if query_parts[0] not in answerers_by_keywords:
+    if not query_parts or query_parts[0] not in answerers_by_keywords:
         return results
 
     for answerer in answerers_by_keywords[query_parts[0]]: