changeset 17331:aa662d2e5829

avoid crash if keyboard command is in startup file (bug #39846) * input.cc (octave_base_reader::do_input_echo, get_debug_input): Avoid dereferencing global LEXER variable if it is NULL.
author John W. Eaton <jwe@octave.org>
date Fri, 23 Aug 2013 17:13:34 -0400
parents 4c1ae06111c9
children c8809de193a3
files libinterp/corefcn/input.cc
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/input.cc
+++ b/libinterp/corefcn/input.cc
@@ -147,7 +147,7 @@
 void
 octave_base_reader::do_input_echo (const std::string& input_string) const
 {
-  int do_echo = LEXER->reading_script_file ?
+  int do_echo = (LEXER && LEXER->reading_script_file) ?
     (Vecho_executing_commands & ECHO_SCRIPTS)
       : (Vecho_executing_commands & ECHO_CMD_LINE) && ! forced_interactive;
 
@@ -554,10 +554,10 @@
   VPS1 = prompt;
 
   if (! (interactive || forced_interactive)
-      || LEXER->reading_fcn_file
-      || LEXER->reading_classdef_file
-      || LEXER->reading_script_file
-      || LEXER->input_from_eval_string ())
+      || (LEXER && (LEXER->reading_fcn_file
+                    || LEXER->reading_classdef_file
+                    || LEXER->reading_script_file
+                    || LEXER->input_from_eval_string ())))
     {
       frame.protect_var (forced_interactive);
       forced_interactive = true;