From 5ea9240f34dfd0f6d1fc9f416fd4b74d11eecbad Mon Sep 17 00:00:00 2001 From: Gregoo Date: Thu, 23 Jan 2025 08:59:40 +0100 Subject: [PATCH] Make the admin database counters failsafe --- bricktracker/sql.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bricktracker/sql.py b/bricktracker/sql.py index 8e05367..77d5466 100644 --- a/bricktracker/sql.py +++ b/bricktracker/sql.py @@ -124,10 +124,14 @@ class BrickSQL(object): # Count the database records def count_records(self) -> list[BrickCounter]: for counter in COUNTERS: - record = self.fetchone('schema/count', table=counter.table) + # Failsafe this one + try: + record = self.fetchone('schema/count', table=counter.table) - if record is not None: - counter.count = record['count'] + if record is not None: + counter.count = record['count'] + except Exception: + pass return COUNTERS