changeset 31666:06acf9b9d2a6 stable

legend.m: stop error when old hidden item are updated (bug #63531) * legend.m (update_displayname): check that the handle belongs to peer_objects before trying to assign a new displayname.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Thu, 15 Dec 2022 21:07:00 +0100
parents 505ed551e366
children 6a66c157fa53 7d36562e5571
files scripts/plot/appearance/legend.m
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/plot/appearance/legend.m	Mon Dec 12 14:35:46 2022 -0800
+++ b/scripts/plot/appearance/legend.m	Thu Dec 15 21:07:00 2022 +0100
@@ -1244,9 +1244,11 @@
     str = {str};
   endif
 
-  str{h == getappdata (hl, "__peer_objects__")} = get (h, "displayname");
-
-  set (hl ,"string", str);
+  idx = h == getappdata (hl, "__peer_objects__");
+  if (any (idx))
+    str{idx} = get (h, "displayname");
+    set (hl ,"string", str);
+  endif
 
 endfunction