changeset 8265:1c213dff76fc

findobj.m: allow handle to be empty
author Ben Abbott <bpabbott@mac.com>
date Wed, 22 Oct 2008 14:04:27 -0400
parents bca580bbda02
children 81b124f463f9
files scripts/ChangeLog scripts/plot/findobj.m
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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  <jwe@octave.org>
 
 	* plot/allchild.m: Move call to get showhiddenhandles outside of
--- 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}))