changeset 25388:644fe81ced33 stable

Stop segfault in debug mode with readline complete (bug #53925). * help.cc (local_functions): Check that variable curr_function is not NULL before using it.
author Rik <rik@octave.org>
date Thu, 17 May 2018 11:54:54 -0700
parents 6cf9d00ad848
children f241f62c9fc5 9e39a53b4e00
files libinterp/corefcn/help.cc
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/help.cc	Thu May 17 09:22:31 2018 -0700
+++ b/libinterp/corefcn/help.cc	Thu May 17 11:54:54 2018 -0700
@@ -488,16 +488,16 @@
 
     octave_user_code *curr_fcn = cs.caller_user_code ();
 
-    if (! curr_fcn)
-      return retval;
-
     // All subfunctions are listed in the top-level function of this file.
-    while (curr_fcn->is_subfunction ())
+    while (curr_fcn && curr_fcn->is_subfunction ())
       {
         symbol_scope pscope = curr_fcn->parent_fcn_scope ();
         curr_fcn = pscope.function ();
       }
 
+    if (! curr_fcn)
+      return retval;
+
     // Get subfunctions.
     const std::list<std::string> names = curr_fcn->subfunction_names ();