changeset 17612:4669cfca69a0

avoid crash when restoring warning states (bug #40199) * ov-usr-fcn.cc (octave_user_function::restore_warning_states): Check type of .saved_warning_states. instead of extracting value and then checking error_state.
author John W. Eaton <jwe@octave.org>
date Tue, 08 Oct 2013 19:11:32 -0400
parents 0dd2cf2e3174
children 6b8df90c8806
files libinterp/octave-value/ov-usr-fcn.cc
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/octave-value/ov-usr-fcn.cc	Tue Oct 08 18:38:40 2013 -0400
+++ b/libinterp/octave-value/ov-usr-fcn.cc	Tue Oct 08 19:11:32 2013 -0400
@@ -764,11 +764,17 @@
 
   if (val.is_defined ())
     {
-      octave_map m = val.map_value ();
+      // Don't use the usual approach of attempting to extract a value
+      // and then checking error_state since this code might be
+      // executing when error_state is already set.  But do fail
+      // spectacularly if .saved_warning_states. is not an octave_map
+      // (or octave_scalar_map) object.
 
-      if (error_state)
+      if (! val.is_map ())
         panic_impossible ();
 
+      octave_map m = val.map_value ();
+
       Cell ids = m.contents ("identifier");
       Cell states = m.contents ("state");