Commit 13e5381d authored by John Tapsell's avatar John Tapsell

DataPlot - Don't crash if the user cancels saving the data or image file

parent 2034be4d
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment