# HG changeset patch # User Michael Goffioul # Date 1416689689 18000 # Node ID eb90f921bbc02dd4778812c7f08b2956ca90d1c8 # Parent 8f6a8422435d9afffc0c2a60ceac3dd16107313e 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. diff --git a/libinterp/octave-value/ov-classdef.cc b/libinterp/octave-value/ov-classdef.cc --- 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 ()); } } }