CipherSettings: fix crash with empty RawKey

Fix crash when CipherSettings::getPassword() is called with empty RawKey.

Related issue #2743
This commit is contained in:
Nikolay Zlatev
2021-07-07 10:37:38 +03:00
parent 3af4c3db81
commit 1e77bc78e4
+5 -1
View File
@@ -16,7 +16,11 @@ std::string CipherSettings::getPassword() const
return sqlb::escapeString(password);
} else {
// Remove the '0x' part at the beginning
return "\"x'" + password.substr(2) + "'\"";
if (password.length() > 2) {
return "\"x'" + password.substr(2) + "'\"";
}
return "''";
}
}