diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a0861b4..ecc3464 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -473,7 +473,8 @@ bool KeepassMainWindow::openDatabase(QString filename,bool IsAuto){ setStateFileModified(static_cast(db)->hasPasswordEncodingChanged()); } else{ - QFile::remove(filename+".lock"); + if (!dbReadOnly && QFile::exists(filename+".lock")) + QFile::remove(filename+".lock"); setStatusBarMsg(StatusBarLoadingFailed); QString error=db->getError(); if(error.isEmpty())error=tr("Unknown error while loading database.");