diff options
Diffstat (limited to 'src/op.cc')
-rw-r--r-- | src/op.cc | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -34,6 +34,7 @@ #include "op.h" #include "scope.h" #include "commodity.h" +#include "pool.h" namespace ledger { @@ -166,10 +167,15 @@ value_t expr_t::op_t::calc(scope_t& scope, ptr_op_t * locus) call_scope_t call_args(scope); if (value_t obj = left()->left()->as_function()(call_args)) { if (obj.is_pointer()) { - scope_t& objscope(obj.as_ref_lval<scope_t>()); - if (ptr_op_t member = objscope.lookup(right()->as_ident())) { - result = member->calc(objscope); - break; + if (obj.as_pointer_lval<scope_t>() == NULL) { + throw_(calc_error, + _("Left operand of . operator is NULL")); + } else { + scope_t& objscope(obj.as_ref_lval<scope_t>()); + if (ptr_op_t member = objscope.lookup(right()->as_ident())) { + result = member->calc(objscope); + break; + } } } } |