diff --git a/libinterp/parse-tree/pt-eval.cc b/libinterp/parse-tree/pt-eval.cc --- a/libinterp/parse-tree/pt-eval.cc +++ b/libinterp/parse-tree/pt-eval.cc @@ -320,21 +320,25 @@ namespace octave std::shared_ptr stmt_list = debug_parser.statement_list (); - stmt_list->accept (tw); - - if (octave_completion_matches_called) - octave_completion_matches_called = false; - - // FIXME: the following statement is here because - // the last command may have been a dbup, dbdown, or - // dbstep command that changed the current debug - // frame. If so, we need to reset the current frame - // for the call stack. But is this right way to do - // this job? What if the statement list was - // something like "dbup; dbstack"? Will the call to - // dbstack use the right frame? If not, how can we - // fix this problem? - tw.goto_frame (tw.debug_frame ()); + if (stmt_list) + { + stmt_list->accept (tw); + + if (octave_completion_matches_called) + octave_completion_matches_called = false; + + // FIXME: the following statement is here + // because the last command may have been a + // dbup, dbdown, or dbstep command that changed + // the current debug frame. If so, we need to + // reset the current frame for the call stack. + // But is this right way to do this job? What + // if the statement list was something like + // "dbup; dbstack"? Will the call to dbstack + // use the right frame? If not, how can we fix + // this problem? + tw.goto_frame (tw.debug_frame ()); + } } octave_quit ();