Mercurial > octave-nkf
comparison libinterp/interpfcn/variables.cc @ 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 | cea08e743c2c |
children | 77795b0ed263 |
comparison
equal
deleted
inserted
replaced
15527:73d23a6e7bf3 | 15528:8d2b3db8b5b0 |
---|---|
2557 void maybe_missing_function_hook (const std::string& name) | 2557 void maybe_missing_function_hook (const std::string& name) |
2558 { | 2558 { |
2559 // Don't do this if we're handling errors. | 2559 // Don't do this if we're handling errors. |
2560 if (buffer_error_messages == 0 && ! Vmissing_function_hook.empty ()) | 2560 if (buffer_error_messages == 0 && ! Vmissing_function_hook.empty ()) |
2561 { | 2561 { |
2562 // Ensure auto-restoration. | 2562 octave_value val = symbol_table::find_function (Vmissing_function_hook); |
2563 unwind_protect frame; | 2563 |
2564 frame.protect_var (Vmissing_function_hook); | 2564 if (val.is_defined ()) |
2565 | 2565 { |
2566 // Clear the variable prior to calling the function. | 2566 // Ensure auto-restoration. |
2567 const std::string func_name = Vmissing_function_hook; | 2567 unwind_protect frame; |
2568 Vmissing_function_hook.clear (); | 2568 frame.protect_var (Vmissing_function_hook); |
2569 | 2569 |
2570 // Call. | 2570 // Clear the variable prior to calling the function. |
2571 feval (func_name, octave_value (name)); | 2571 const std::string func_name = Vmissing_function_hook; |
2572 Vmissing_function_hook.clear (); | |
2573 | |
2574 // Call. | |
2575 feval (func_name, octave_value (name)); | |
2576 } | |
2572 } | 2577 } |
2573 } | 2578 } |
2574 | 2579 |
2575 DEFUN (__varval__, args, , | 2580 DEFUN (__varval__, args, , |
2576 "-*- texinfo -*-\n\ | 2581 "-*- texinfo -*-\n\ |