Skip to content

Commit d3b0986

Browse files
committed
fix: return default language code if database returns null
1 parent 068fbf8 commit d3b0986

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

database/database.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,10 @@ def get_lang_id(self, chat_id):
119119
self.cursor.execute("SELECT lang_id FROM chats WHERE chat_id=?;", [str(chat_id)])
120120
result = self.cursor.fetchone()
121121
if result:
122-
return result[0]
123-
else:
124-
return "en"
122+
if result[0]:
123+
# Make sure that the database stored an actual value and not "None"
124+
return result[0]
125+
return "en"
125126

126127
def set_lang_id(self, chat_id, lang_id):
127128
if lang_id is None:

0 commit comments

Comments
 (0)