Blob Blame Raw
diff -up octave-4.2.2/libinterp/corefcn/input.cc.crash octave-4.2.2/libinterp/corefcn/input.cc
--- octave-4.2.2/libinterp/corefcn/input.cc.crash	2018-02-28 11:41:44.000000000 -0700
+++ octave-4.2.2/libinterp/corefcn/input.cc	2018-06-21 21:29:18.352517844 -0600
@@ -298,7 +298,7 @@ octave_base_reader::octave_gets (bool& e
 
       octave_diary << retval;
 
-      if (retval[retval.length () - 1] != '\n')
+      if (!retval.empty () && retval.back () != '\n')
         octave_diary << "\n";
 
       do_input_echo (retval);