From 19727d9c578228bccbacebb83fcf5b55ea5a5b9e Mon Sep 17 00:00:00 2001 From: abraunegg Date: Sun, 4 Dec 2022 20:20:55 +1100 Subject: [PATCH] Fix application crash when exiting due to failure state (#2244) * Fix a potential crash when an unclean exit is performed and any database access cannot be cleanly shutdown --- src/itemdb.d | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/itemdb.d b/src/itemdb.d index d3210609..28a6464a 100644 --- a/src/itemdb.d +++ b/src/itemdb.d @@ -503,8 +503,14 @@ final class ItemDatabase // Perform a vacuum on the database, commit WAL / SHM to file void performVacuum() { - auto stmt = db.prepare("VACUUM;"); - stmt.exec(); + try { + auto stmt = db.prepare("VACUUM;"); + stmt.exec(); + } catch (SqliteException e) { + writeln(); + log.error("ERROR: Unable to perform a database vacuum: " ~ e.msg); + writeln(); + } } // Select distinct driveId items from database