changeset 11456:fbdb95640852

get: return empty matrix if no values are found
author John W. Eaton <jwe@octave.org>
date Fri, 07 Jan 2011 12:52:46 -0500
parents 2be9e22796d2
children 33f6384d2b78
files src/ChangeLog src/graphics.cc
diffstat 2 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Jan 06 20:46:03 2011 +0100
+++ b/src/ChangeLog	Fri Jan 07 12:52:46 2011 -0500
@@ -28,6 +28,11 @@
 	(text::properties::renderer): New class member of type ft_render.
 	(text::properties::pixels): New class member of type uint8NDArray.
 
+2011-01-07  John W. Eaton  <jwe@octave.org>
+
+	* graphics.cc (Fget): Return empty matrix if no values are found.
+	Bug #32067.
+
 2011-01-06  John W. Eaton  <jwe@octave.org>
 
 	* DLD-FUNCTIONS/rand.cc (Frandperm): Tag call to floor with gnulib::.
--- a/src/graphics.cc	Thu Jan 06 20:46:03 2011 +0100
+++ b/src/graphics.cc	Fri Jan 07 12:52:46 2011 -0500
@@ -6150,15 +6150,21 @@
     {
       octave_idx_type len = vals.numel ();
 
-      if (len > 1)
-        retval = vals;
+      if (len == 0)
+        retval = Matrix ();
       else if (len == 1)
         retval = vals(0);
+      else
+        retval = vals;
     }
 
   return retval;
 }
 
+/*
+%!assert (get (findobj (0, 'Tag', 'nonexistenttag'), 'nonexistentproperty'), [])
+*/
+
 // Return all properties from the graphics handle @var{h}.
 // If @var{h} is a vector, return a cell array including the
 // property values or lists respectively.