Handle possible nullptr exception

This commit is contained in:
Stefan Forstenlechner 2024-06-26 14:28:51 +02:00
parent 2c03738580
commit b0fa6b5e68
2 changed files with 8 additions and 1 deletions

View File

@ -2674,6 +2674,10 @@ Disable safe saves and try again?</source>
<source>Do you want to remove the passkey from this entry?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Could not upload the database. Remote handler was not initialized.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>EditEntryWidget</name>

View File

@ -1135,7 +1135,10 @@ void DatabaseWidget::syncDatabaseWithLockedDatabase(const QString& filePath, con
void DatabaseWidget::uploadAndFinishSync(const RemoteParams* params, RemoteHandler::RemoteResult result)
{
if (result.success && !params->uploadCommand.isEmpty()) {
if (!m_remoteHandler) {
result.success = false;
result.errorMessage = tr("Could not upload the database. Remote handler was not initialized.");
} else if (result.success && !params->uploadCommand.isEmpty()) {
emit updateSyncProgress(75, tr("Uploading..."));
result = m_remoteHandler->upload(params);
}