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:
parent
22f7f958ed
commit
757791eea4
|
@ -352,6 +352,10 @@ void ProfileForm::onExportClicked()
|
||||||
QDir::home().filePath(current),
|
QDir::home().filePath(current),
|
||||||
//: save dialog filter
|
//: save dialog filter
|
||||||
tr("Tox save file (*.tox)"), nullptr);
|
tr("Tox save file (*.tox)"), nullptr);
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const IProfileInfo::SaveResult result = profileInfo->exportProfile(path);
|
const IProfileInfo::SaveResult result = profileInfo->exportProfile(path);
|
||||||
if (result == IProfileInfo::SaveResult::OK) {
|
if (result == IProfileInfo::SaveResult::OK) {
|
||||||
return;
|
return;
|
||||||
|
@ -415,6 +419,9 @@ void ProfileForm::onSaveQrClicked()
|
||||||
const QString path = QFileDialog::getSaveFileName(
|
const QString path = QFileDialog::getSaveFileName(
|
||||||
Q_NULLPTR, tr("Save", "save qr image"), QDir::home().filePath(current),
|
Q_NULLPTR, tr("Save", "save qr image"), QDir::home().filePath(current),
|
||||||
tr("Save QrCode (*.png)", "save dialog filter"), nullptr);
|
tr("Save QrCode (*.png)", "save dialog filter"), nullptr);
|
||||||
|
if (path.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const IProfileInfo::SaveResult result = profileInfo->saveQr(*qr->getImage(), path);
|
const IProfileInfo::SaveResult result = profileInfo->saveQr(*qr->getImage(), path);
|
||||||
if (result == IProfileInfo::SaveResult::OK) {
|
if (result == IProfileInfo::SaveResult::OK) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user