changeset 15308:b516da00c5e4

don't insert unknonwn parameters in internal octave_config_info struct * toplev.cc (Foctave_config_info): Check that field exists before attempting to access contents.
author John W. Eaton <jwe@octave.org>
date Wed, 05 Sep 2012 20:22:20 -0400
parents ec3a9ff6c375
children a4d7909c4edb
files libinterp/interpfcn/toplev.cc
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/toplev.cc
+++ b/libinterp/interpfcn/toplev.cc
@@ -1474,12 +1474,17 @@
 
       if (! error_state)
         {
-          Cell c = m.contents (arg.c_str ());
+          if (m.isfield (arg))
+            {
+              Cell c = m.contents (arg);
 
-          if (c.is_empty ())
-            error ("octave_config_info: no info for `%s'", arg.c_str ());
+              if (c.is_empty ())
+                error ("octave_config_info: no info for `%s'", arg.c_str ());
+              else
+                retval = c(0);
+            }
           else
-            retval = c(0);
+            error ("octave_config_info: invalid parameter `%s'", arg.c_str ());
         }
     }
   else if (nargin == 0)