changeset 26906:db59dabf1685

feval: silently return empty value list if function object is undefined * oct-parse.yy (feval): In version that takes function, handle, or string in an octave_value object, return early if object containing function, handle, or name is undefined.
author John W. Eaton <jwe@octave.org>
date Thu, 14 Mar 2019 06:09:29 +0000
parents 91e5d37aaba0
children 1d3730539776
files libinterp/parse-tree/oct-parse.yy
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/parse-tree/oct-parse.yy	Wed Mar 13 16:52:30 2019 -0700
+++ b/libinterp/parse-tree/oct-parse.yy	Thu Mar 14 06:09:29 2019 +0000
@@ -5216,6 +5216,15 @@
   octave_value_list
   feval (const octave_value& val, const octave_value_list& args, int nargout)
   {
+    // FIXME: do we really want to silently return an empty ovl if
+    // the function object is undefined?  It's essentially what the
+    // version above that accepts a pointer to an octave_function
+    // object does and some code was apparently written to rely on it
+    // (for example, __ode15__).
+
+    if (val.is_undefined ())
+      return ovl ();
+
     if (val.is_function ())
       {
         return feval (val.function_value (), args, nargout);