changeset 19538:eb90f921bbc0

Check return value of classdef set-method's (bug #43598) * ov-classdef.cc (cdef_property::cdef_property_rep::set_value): Check return value of set-method and issue a warning when not a classdef object.
author Michael Goffioul <michael.goffioul@gmail.com>
date Sat, 22 Nov 2014 15:54:49 -0500
parents 8f6a8422435d
children 112fc552ea22
files libinterp/octave-value/ov-classdef.cc
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-classdef.cc
+++ b/libinterp/octave-value/ov-classdef.cc
@@ -3200,12 +3200,18 @@
 
       if (! error_state)
         {
-          if (args.length() > 0)
+          if (args.length () > 0 && args(0).is_defined ())
             {
-              cdef_object new_obj = to_cdef (args(0));
-
-              if (! error_state)
-                obj = new_obj;
+              if (args (0).is_classdef_object ())
+                {
+                  cdef_object new_obj = to_cdef (args(0));
+
+                  if (! error_state)
+                    obj = new_obj;
+                }
+              else
+                ::warning ("set-method of property `%s' returned a non-classdef object",
+                           get_name ().c_str ());
             }
         }
     }