mirror of
https://github.com/fergalmoran/flameshot.git
synced 2026-01-07 01:23:58 +00:00
Fix config export (#220)
If the user presses the Cancel button using the QFileDialog::getSaveFileName() modal file dialog, it will return null string. Adding this condition will prevent to show an error when trying to write to disk using an invalid filename.
This commit is contained in:
@@ -100,6 +100,12 @@ void GeneneralConf::importConfiguration() {
|
||||
void GeneneralConf::exportFileConfiguration() {
|
||||
QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"),
|
||||
"flameshot.conf");
|
||||
|
||||
// Cancel button
|
||||
if (fileName.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QFile targetFile(fileName);
|
||||
if (targetFile.exists()) {
|
||||
targetFile.remove();
|
||||
|
||||
Reference in New Issue
Block a user