diff --git a/GUI/View/PlotUtil/SavePlotAssistant.cpp b/GUI/View/PlotUtil/SavePlotAssistant.cpp index 901d68290b9958a8ad4a4529ee8f75ca271188a0..6f52bd8499bec54d045e5b9745a7cf2cc5e24a06 100644 --- a/GUI/View/PlotUtil/SavePlotAssistant.cpp +++ b/GUI/View/PlotUtil/SavePlotAssistant.cpp @@ -139,18 +139,17 @@ void GUI::Plot::savePlot(const QString& dirname, QCustomPlot* plot, const Datafi nullptr, "Save Plot", defaultName, getFilterString(), &selectedFilter, appSettings->useNativeFileDialog() ? QFileDialog::Options() : QFileDialog::DontUseNativeDialog); + if (fileName.isEmpty()) + return; QString nameToSave = composeFileName(fileName, selectedFilter); - - if (!nameToSave.isEmpty()) { - try { - saveToFile(nameToSave, plot, output_data); - } catch (const std::exception& ex) { - QString message = "Attempt to save file with the name '"; - message.append(nameToSave); - message.append("' has failed with following error message\n\n"); - message.append(QString::fromStdString(ex.what())); - QMessageBox::warning(nullptr, "Houston, we have a problem.", message); - } + try { + saveToFile(nameToSave, plot, output_data); + } catch (const std::exception& ex) { + QString message = "Attempt to save file with the name '"; + message.append(nameToSave); + message.append("' has failed with following error message\n\n"); + message.append(QString::fromStdString(ex.what())); + QMessageBox::warning(nullptr, "Houston, we have a problem.", message); } }