# HG changeset patch # User Mike Miller # Date 1350342431 14400 # Node ID 8d2b3db8b5b0bb0cee496dfbe43e4b36c1a9c532 # Parent 73d23a6e7bf3c5fbd28e9ec7c2d6cdc9b202e3ad Allow missing_function_hook to fail silently * variables.cc (maybe_missing_function_hook): Check for existence of missing_function_hook before calling it. diff --git a/libinterp/interpfcn/variables.cc b/libinterp/interpfcn/variables.cc --- 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)); + } } }