summaryrefslogtreecommitdiff
path: root/src/op.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/op.cc')
-rw-r--r--src/op.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/op.cc b/src/op.cc
index f80d444a..559db616 100644
--- a/src/op.cc
+++ b/src/op.cc
@@ -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;
+ }
}
}
}