Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(chatform): check for empty path when exporting profile
Browse files Browse the repository at this point in the history
Fixes #5146. If the filedialog is cancelled the returned path is empty.
Do not try to export the profile in this case.
  • Loading branch information
ezavod committed May 29, 2018
1 parent 22f7f95 commit 757791e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/widget/form/profileform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ void ProfileForm::onExportClicked()
QDir::home().filePath(current),
//: save dialog filter
tr("Tox save file (*.tox)"), nullptr);
if (path.isEmpty()) {
return;
}

const IProfileInfo::SaveResult result = profileInfo->exportProfile(path);
if (result == IProfileInfo::SaveResult::OK) {
return;
Expand Down Expand Up @@ -415,6 +419,9 @@ void ProfileForm::onSaveQrClicked()
const QString path = QFileDialog::getSaveFileName(
Q_NULLPTR, tr("Save", "save qr image"), QDir::home().filePath(current),
tr("Save QrCode (*.png)", "save dialog filter"), nullptr);
if (path.isEmpty()) {
return;
}

const IProfileInfo::SaveResult result = profileInfo->saveQr(*qr->getImage(), path);
if (result == IProfileInfo::SaveResult::OK) {
Expand Down

0 comments on commit 757791e

Please sign in to comment.