diff --git a/maubot.yaml b/maubot.yaml index e9b225a..75332d5 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -1,6 +1,6 @@ maubot: 0.1.0 id: lomion.tmdb -version: 1.0.0 +version: 1.0.1 license: AGPL 3.0 modules: - tmdb diff --git a/tmdb/database.py b/tmdb/database.py index 4dfd103..9e2cf3b 100644 --- a/tmdb/database.py +++ b/tmdb/database.py @@ -45,7 +45,11 @@ class Database: def get_language(self, user_id): rows = self.db.execute(select([self.language.c.language]) .where(self.language.c.user_id == user_id)) - return rows.fetchone()['language'] + row = rows.fetchone() + if row: + return row['language'] + else: + return None def set_poster_size(self, user_id, size): with self.db.begin() as tx: @@ -55,4 +59,8 @@ class Database: def get_poster_size(self, user_id): rows = self.db.execute(select([self.tmdb_poster_size.c.size]) .where(self.tmdb_poster_size.c.user_id == user_id)) - return rows.fetchone()['size'] \ No newline at end of file + row = rows.fetchone() + if row: + return row['size'] + else: + return None \ No newline at end of file