# HG changeset patch # User John W. Eaton # Date 1381273892 14400 # Node ID 4669cfca69a012f1e01623071d0aef492d397f45 # Parent 0dd2cf2e31746cab5f61c8ddc98ccccf6c969d07 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. diff -r 0dd2cf2e3174 -r 4669cfca69a0 libinterp/octave-value/ov-usr-fcn.cc --- 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");