From aa9bbc1bdb25da727ecc92bb92b0b2d9e18752a9 Mon Sep 17 00:00:00 2001 From: Bart De Vries Date: Sun, 10 Nov 2024 18:34:13 +0100 Subject: [PATCH] On startup, remove feed entries with empty URL on startup This should never happen, but occasionally did when something went wrong while adding a new feed, e.g. a crash. This would then cause a segfault on startup. BUG: 495961 --- src/database.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/database.cpp b/src/database.cpp index 318fbadf..679e9846 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -348,5 +348,10 @@ void Database::setWalMode() void Database::cleanup() { - // TODO: create database sanity checks, or, alternatively, create database scrub routine + // delete rows with empty feed urls, as this should never happen, but could + // occur when something goes wrong (like a crash) when trying to add a new + // feed + QSqlQuery query; + query.prepare(QStringLiteral("DELETE FROM Feeds WHERE url is NULL or url='';")); + execute(query); }