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

This commit is contained in:
Alexandre Flament 2021-02-22 18:10:57 +01:00
parent e2fb500892
commit 4fa1290c11

View File

@ -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]]: