From 4f3d3d8395b5ca416792e2f12f273b171398d48e Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Fri, 3 Mar 2023 19:23:14 -0500 Subject: [PATCH] database: fix error when trying to upgrade the schema for a game that wasn't created yet --- core/data/schema/base.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/data/schema/base.py b/core/data/schema/base.py index 78f3ab4..fd49ac1 100644 --- a/core/data/schema/base.py +++ b/core/data/schema/base.py @@ -85,7 +85,12 @@ class BaseData(): result = self.execute(sql) if result is None: return None - return result.fetchone()["version"] + + row = result.fetchone() + if row is None: + return None + + return row["version"] def set_schema_ver(self, ver: int, game: str = "CORE") -> Optional[int]: sql = insert(schema_ver).values(game = game, version = ver)