From 4b4be7069ab4899a4eb81207fb61df5d3807c4bd Mon Sep 17 00:00:00 2001
From: Jacques Grelet <jacques.grelet@ird.fr>
Date: Wed, 12 Sep 2018 12:33:15 +0000
Subject: [PATCH] add test if user press cancel or escape

---
 tsgqc.m | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tsgqc.m b/tsgqc.m
index df12f33..19bd0d6 100644
--- a/tsgqc.m
+++ b/tsgqc.m
@@ -3758,10 +3758,15 @@ end
     printpreview(get(hPlotAxes(4),'parent'));
   end
 
+  % save the map as image file
+  % --------------------------
   function mapSaveAsCallback(src, evnt)
     [file, path] = uiputfile({'*.jpeg';'*.png';'*.epsc'});
-    saveas(get(hPlotAxes(4),'parent'), fullfile(path,file));
+    if file == 0
+      return
+    end
     fprintf(1, 'Save figure map as %s\n', fullfile(path,file));
+    saveas(get(hPlotAxes(4),'parent'), fullfile(path,file));
   end
 
 
-- 
GitLab