# HG changeset patch # User Ben Abbott # Date 1224698667 14400 # Node ID 1c213dff76fcd2575b202eda344090b544570fed # Parent bca580bbda02ba8fd6741981690964f20998e116 findobj.m: allow handle to be empty diff --git a/scripts/ChangeLog b/scripts/ChangeLog --- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -2,6 +2,8 @@ * plot/cla.m: Fix error when no children to clear. + * plot/findobj.m: Allow handle to be empty. + 2008-10-22 John W. Eaton * plot/allchild.m: Move call to get showhiddenhandles outside of diff --git a/scripts/plot/findobj.m b/scripts/plot/findobj.m --- a/scripts/plot/findobj.m +++ b/scripts/plot/findobj.m @@ -69,12 +69,18 @@ handles = 0; n1 = 0; else - if (ishandle (varargin{1}(1))) - handles = varargin{1}; - n1 = 2; + if (! isempty (varargin{1})) + if (ishandle (varargin{1}(1))) + handles = varargin{1}; + n1 = 2; + else + handles = 0; + n1 = 1; + endif else - handles = 0; - n1 = 1; + ## Return [](0x1) for compatibility. + h = zeros (0, 1); + return; endif if (n1 <= nargin) if (ischar (varargin{n1}))