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
This commit is contained in:
Bart De Vries 2024-11-10 18:34:13 +01:00
parent ceb919ba63
commit aa9bbc1bdb
No known key found for this signature in database
GPG Key ID: 7285665DA6E2D42B
1 changed files with 6 additions and 1 deletions

View File

@ -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);
}