summaryrefslogtreecommitdiff
path: root/db_actions.py
diff options
context:
space:
mode:
authorJari Wiik <jwiik@local>2023-11-16 22:46:25 +0200
committerJari Wiik <jwiik@local>2023-11-16 22:46:25 +0200
commitcaae3944492b43e470babc500b913e285bf1ea88 (patch)
tree03f5e2273496398f93f51dec1780f4528d0c3b98 /db_actions.py
parent0ed244ef2dd27a835ec12fdbc93a1f20bbcd89eb (diff)
Fix lock-up situation when database gets zapped while session is still on
Diffstat (limited to 'db_actions.py')
-rw-r--r--db_actions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/db_actions.py b/db_actions.py
index 26f69df..fca9ab0 100644
--- a/db_actions.py
+++ b/db_actions.py
@@ -21,7 +21,8 @@ def user_get_nick(id):
sql = "SELECT nick \
FROM users \
WHERE id=(:id);"
- return db.session.execute(text(sql), { "id":id }).fetchone()[0]
+ result = db.session.execute(text(sql), { "id":id }).fetchone()
+ return result[0] if result else result
def user_exists(nick):
sql = "SELECT COUNT(id) \