diff --git a/src/updates/inline.py b/src/updates/inline.py
index d1ecd59..aebc5a3 100644
--- a/src/updates/inline.py
+++ b/src/updates/inline.py
@@ -123,7 +123,7 @@ def not_found_answer():
results = api.call('cercaNumeroTrenoTrenoAutocomplete', iq.query)
except HTTPError:
results = []
- if len(results) == 0:
+ if results is None or len(results) == 0:
return not_found_answer()
u.increaseStat("stats_inline_queries")
@@ -200,7 +200,7 @@ def not_found_answer():
else: # Search station
results = api.call('cercaStazione', iq.query)
- if len(results) == 0:
+ if results is None or len(results) == 0:
return not_found_answer()
elif len(results) > 0:
diff --git a/src/updates/messages.py b/src/updates/messages.py
index 5b210f4..3d61706 100644
--- a/src/updates/messages.py
+++ b/src/updates/messages.py
@@ -42,7 +42,7 @@ def process_messages(bot, message, u):
except HTTPError:
results = []
- if len(results) == 0:
+ if results is None or len(results) == 0:
u.state("home")
text = (
"š
Cerca treno per numero"
@@ -102,7 +102,7 @@ def process_messages(bot, message, u):
elif state == "train_byiti":
results = api.call('cercaStazione', message.text)
- if len(results) == 0:
+ if results is None or len(results) == 0:
text = (
"š
Cerca treno per itinerario"
"\nā Stazione di partenza non trovata, riprovare o annullare?"
@@ -152,7 +152,7 @@ def process_messages(bot, message, u):
elif state == "train_byiti_2":
results = api.call('cercaStazione', message.text)
- if len(results) == 0:
+ if results is None or len(results) == 0:
text = (
"š
Cerca treno per itinerario"
"\nā Stazione di arrivo non trovata, riprovare o annullare?"
@@ -259,7 +259,7 @@ def minifyStation(__str):
elif state == "station":
results = api.call('cercaStazione', message.text)
- if len(results) == 0:
+ if results is None or len(results) == 0:
text = (
"š Cerca stazione"
"\nā Stazione non trovata, riprovare o annullare?"