changeset 20470:82712ed1be68

strfunc: Issue error when given anonymous function (partial fix bug #45682). * ov-fcn-handle.cc (Fstr2func): Check that input string does not start with '@' and issue error if it does.
author Rik <rik@octave.org>
date Sun, 09 Aug 2015 20:24:42 -0700
parents 859423f351a3
children bf47ac616bc0
files libinterp/octave-value/ov-fcn-handle.cc
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-fcn-handle.cc	Sun Aug 09 20:35:44 2015 -0700
+++ b/libinterp/octave-value/ov-fcn-handle.cc	Sun Aug 09 20:24:42 2015 -0700
@@ -1869,6 +1869,11 @@
       if (args(0).is_string ())
         {
           std::string nm = args(0).string_value ();
+          if (nm[0] == '@')
+            {
+              error ("str2func: Can't process anonymous functions.");
+              return retval;
+            }
           retval = make_fcn_handle (nm, nargin != 2);
         }
       else