diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts
index 919ef36e5..5c78cf98c 100644
--- a/share/translations/keepassxc_en.ts
+++ b/share/translations/keepassxc_en.ts
@@ -7924,6 +7924,10 @@ Kernel: %3 %4
This options is deprecated, use --set-key-file instead.
+
+ KeePassXC is not running. No open database to lock
+
+ QtIOCompressor
diff --git a/src/main.cpp b/src/main.cpp
index 47fe55483..f426a76e9 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -156,6 +156,14 @@ int main(int argc, char** argv)
return EXIT_SUCCESS;
}
+ if (parser.isSet(lockOption)) {
+ qWarning() << QObject::tr("KeePassXC is not running. No open database to lock").toUtf8().constData();
+
+ // still return with EXIT_SUCCESS because when used within a script for ensuring that there is no unlocked
+ // keepass database (e.g. screen locking) we can consider it as successful
+ return EXIT_SUCCESS;
+ }
+
if (!Crypto::init()) {
QString error = QObject::tr("Fatal error while testing the cryptographic functions.");
error.append("\n");