1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

fix(chatform): check for empty path when exporting profile

Fixes #5146. If the filedialog is cancelled the returned path is empty.
Do not try to export the profile in this case.
This commit is contained in:
ezavod 2018-05-29 10:26:41 +02:00
parent 22f7f958ed
commit 757791eea4
No known key found for this signature in database
GPG Key ID: E9FDE71887B4D083

View File

@ -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;
@ -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) {