changeset 5200:240ed0328925

[project @ 2005-03-14 15:53:44 by jwe]
author jwe
date Mon, 14 Mar 2005 15:53:44 +0000
parents 16a6247730d9
children 63c15a67612d
files src/ChangeLog src/DLD-FUNCTIONS/dispatch.cc
diffstat 2 files changed, 17 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-14  John W. Eaton  <jwe@octave.org>
+
+	* DLD-FUNCTIONS/dispatch.cc (Fbuiltin):	Avoid crash if symbol
+	lookup fails.
+
 2005-03-10  John W. Eaton  <jwe@octave.org>
 
 	* toplev.cc (Foctave_config_info): Print error instead of crashing
--- a/src/DLD-FUNCTIONS/dispatch.cc
+++ b/src/DLD-FUNCTIONS/dispatch.cc
@@ -307,16 +307,22 @@
 	return retval;
 
       symbol_record *sr = fbi_sym_tab->lookup (name, 0);
-      if (sr->def().type_id () == octave_dispatch::static_type_id ())
+
+      if (sr)
 	{
-	  octave_function *fcn = builtin (name);
+	  if (sr->def().type_id () == octave_dispatch::static_type_id ())
+	    {
+	      octave_function *fcn = builtin (name);
 
-	  if (!error_state && fcn)
-	    retval = fcn->do_multi_index_op (nargout,
-					     args.splice (0, 1, retval));
+	      if (!error_state && fcn)
+		retval = fcn->do_multi_index_op (nargout,
+						 args.splice (0, 1, retval));
+	    }
+	  else
+	    retval = feval (name, args, nargout);
 	}
       else
-	retval = feval (name, args, nargout);
+	error ("builtin: lookup for symbol `%s' failed", name.c_str ());
     }
   else
     print_usage ("builtin");