From 13e5381d3af23b765066c037a2f3b1be7bb1dfc7 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Tue, 8 Oct 2013 17:11:34 +0100 Subject: [PATCH] DataPlot - Don't crash if the user cancels saving the data or image file --- src/ui/QGCDataPlot2D.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc index 02dc9d1..4a24151 100644 --- a/src/ui/QGCDataPlot2D.cc +++ b/src/ui/QGCDataPlot2D.cc @@ -120,6 +120,8 @@ void QGCDataPlot2D::savePlot() fileName = QFileDialog::getSaveFileName( this, "Export File Name", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), "PDF Documents (*.pdf);;SVG Images (*.svg)"); + if (fileName.isEmpty()) + return; if (!fileName.contains(".")) { // .pdf is default extension @@ -138,6 +140,8 @@ void QGCDataPlot2D::savePlot() fileName = QFileDialog::getSaveFileName( this, "Export File Name", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), "PDF Documents (*.pdf);;SVG Images (*.svg)"); + if (fileName.isEmpty()) + return; //Abort if cancelled } if (fileName.endsWith(".pdf")) { @@ -689,6 +693,8 @@ void QGCDataPlot2D::saveCsvLog() fileName = QFileDialog::getSaveFileName( this, "Export CSV File Name", QDesktopServices::storageLocation(QDesktopServices::DesktopLocation), "CSV file (*.csv);;Text file (*.txt)"); + if (fileName.isEmpty()) + return; //User cancelled if (!fileName.contains(".")) { // .csv is default extension