Mercurial > hg > octave-nkf
changeset 15528:8d2b3db8b5b0
Allow missing_function_hook to fail silently
* variables.cc (maybe_missing_function_hook): Check for existence of
missing_function_hook before calling it.
author | Mike Miller <mtmiller@ieee.org> |
---|---|
date | Mon, 15 Oct 2012 19:07:11 -0400 |
parents | 73d23a6e7bf3 |
children | 9a7f73fc304f |
files | libinterp/interpfcn/variables.cc |
diffstat | 1 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/interpfcn/variables.cc +++ b/libinterp/interpfcn/variables.cc @@ -2559,16 +2559,21 @@ // Don't do this if we're handling errors. if (buffer_error_messages == 0 && ! Vmissing_function_hook.empty ()) { - // Ensure auto-restoration. - unwind_protect frame; - frame.protect_var (Vmissing_function_hook); - - // Clear the variable prior to calling the function. - const std::string func_name = Vmissing_function_hook; - Vmissing_function_hook.clear (); - - // Call. - feval (func_name, octave_value (name)); + octave_value val = symbol_table::find_function (Vmissing_function_hook); + + if (val.is_defined ()) + { + // Ensure auto-restoration. + unwind_protect frame; + frame.protect_var (Vmissing_function_hook); + + // Clear the variable prior to calling the function. + const std::string func_name = Vmissing_function_hook; + Vmissing_function_hook.clear (); + + // Call. + feval (func_name, octave_value (name)); + } } }