From 593753060b5373d4f63b9455c1976666779c263e Mon Sep 17 00:00:00 2001
From: giuliaghirardini <giulia.ghirardini@skywarder.eu>
Date: Wed, 23 Apr 2025 18:12:24 +0200
Subject: [PATCH] [esf] Fixed a bug for export only one figure. Handle_getter
 didn't see the object. Forced the export then

---
 .../exportStandardizedFigure/fct/exportFigureCallback.m   | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/functions/utilities/exportStandardizedFigure/fct/exportFigureCallback.m b/functions/utilities/exportStandardizedFigure/fct/exportFigureCallback.m
index 56a22f3..c6cd090 100644
--- a/functions/utilities/exportStandardizedFigure/fct/exportFigureCallback.m
+++ b/functions/utilities/exportStandardizedFigure/fct/exportFigureCallback.m
@@ -32,7 +32,13 @@ end
 figurePath = uigetdir;
 
 % selectedIdx = dropDown.figSelection.Value;
-selectedIdx = handle_getters.Value;
+if isstruct(handle_getters) || isobject(handle_getters)
+    selectedIdx = handle_getters.Value;
+else
+    warning('handle_getters is not a struct or object. It is a %s.', class(handle_getters));
+    selectedIdx = dropDown.figSelection.Items{1};  % or some default fallback
+end
+
 figHandles = findFigures(fig);
 %figToExp = figHandles(strcmp(dropDown.figSelection.Items, selectedIdx));
 figToExp = figHandles(strcmp(dropDown.figSelection.Items, selectedIdx));
-- 
GitLab