From e69859dc72aa30fe89cfc593c9d35fa67f632754 Mon Sep 17 00:00:00 2001 From: Alfredo Ramos Date: Sun, 13 May 2018 16:46:17 -0500 Subject: [PATCH] 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. --- src/config/geneneralconf.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config/geneneralconf.cpp b/src/config/geneneralconf.cpp index d34b5ff0..3534d414 100644 --- a/src/config/geneneralconf.cpp +++ b/src/config/geneneralconf.cpp @@ -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();