From 72c09cc0bf6247a36c9a2dae6109ca4583ff2f6e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 19 Jan 2009 22:29:36 -0400 Subject: [PATCH] Generate a better error if a function operand is invalid. --- src/op.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/op.cc b/src/op.cc index b19ac730..75c2d5e8 100644 --- a/src/op.cc +++ b/src/op.cc @@ -93,12 +93,11 @@ value_t expr_t::op_t::calc(scope_t& scope) call_args.set_args(right()->calc(scope)); ptr_op_t func = left(); - string name; assert(func->kind == IDENT); func = func->left(); - if (func->kind != FUNCTION) + if (! func || func->kind != FUNCTION) throw_(calc_error, "Calling non-function"); return func->as_function()(call_args);