SyncJournal: Check file existence even for open dbs #6049

With WAL mode sqlite seems to occasionally crash when the
underlying filesystem goes away.
This commit is contained in:
Christian Kamm 2018-05-16 10:50:34 +02:00 committed by Roeland Jago Douma
parent a348ff3134
commit cc04ce9fe4
No known key found for this signature in database
GPG key ID: F941078878347C0C

View file

@ -273,6 +273,11 @@ bool SyncJournalDb::sqlFail(const QString &log, const SqlQuery &query)
bool SyncJournalDb::checkConnect() bool SyncJournalDb::checkConnect()
{ {
if (_db.isOpen()) { if (_db.isOpen()) {
if (!QFile::exists(_dbFile)) {
qCWarning(lcDb) << "Database open, but file file" + _dbFile + " does not exist";
close();
return false;
}
return true; return true;
} }