changeset 28776:d3643467d235

maint: merge stable to default.
author John W. Eaton <jwe@octave.org>
date Tue, 22 Sep 2020 22:43:21 -0400
parents d2ad5e0e5aca (current diff) 2893db10b8d2 (diff)
children 1be026ad8e61
files
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/call-stack.cc	Tue Sep 22 14:19:11 2020 -0400
+++ b/libinterp/corefcn/call-stack.cc	Tue Sep 22 22:43:21 2020 -0400
@@ -72,17 +72,19 @@
 
     octave_function *fcn = nullptr;
 
-    size_t idx = size ();
+    size_t idx = m_curr_frame;
 
-    if (idx > 1 && skip_first)
+    if (idx > 0 && skip_first)
       --idx;
 
-    while (--idx)
+    while (true)
       {
         fcn = m_cs[idx]->function ();
 
-        if (fcn)
+        if (fcn || idx == 0)
           break;
+
+        --idx;
       }
 
     return fcn;