summaryrefslogtreecommitdiff
path: root/valexpr.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-19 21:36:34 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-19 21:36:34 -0400
commitd568319495a0695582797de0be4b85e1e06e73b2 (patch)
treecda7e94b2da52b32006c6a83b335d72ff2ccc165 /valexpr.cc
parent150abce0dbd11863e4a8309fd306a4c2667501f8 (diff)
parent2aeee0bb64b56959ebcf86165c0b31630e0f92ac (diff)
downloadfork-ledger-d568319495a0695582797de0be4b85e1e06e73b2.tar.gz
fork-ledger-d568319495a0695582797de0be4b85e1e06e73b2.tar.bz2
fork-ledger-d568319495a0695582797de0be4b85e1e06e73b2.zip
Merged in bug fixes from master (done for 2.6.1b)
Diffstat (limited to 'valexpr.cc')
-rw-r--r--valexpr.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/valexpr.cc b/valexpr.cc
index ce1f1cb8..85024ddf 100644
--- a/valexpr.cc
+++ b/valexpr.cc
@@ -582,8 +582,12 @@ void value_expr_t::compute(value_t& result, const details_t& details,
}
case O_COM:
- assert(left);
- assert(right);
+ if (! left)
+ throw new compute_error("Comma operator missing left operand",
+ new valexpr_context(this));
+ if (! right)
+ throw new compute_error("Comma operator missing right operand",
+ new valexpr_context(this));
left->compute(result, details, context);
right->compute(result, details, context);
break;
@@ -1039,8 +1043,8 @@ value_expr_t * parse_value_term(std::istream& in, scope_t * scope,
unexpected(c, ']');
in.get(c);
- node.reset(new value_expr_t(value_expr_t::CONSTANT));
interval_t timespan(buf);
+ node.reset(new value_expr_t(value_expr_t::CONSTANT));
node->value = new value_t(timespan.first());
break;
}
@@ -1734,10 +1738,12 @@ bool print_value_expr(std::ostream& out,
break;
case value_expr_t::O_COM:
- if (print_value_expr(out, node->left, relaxed, node_to_find, start_pos, end_pos))
+ if (node->left &&
+ print_value_expr(out, node->left, relaxed, node_to_find, start_pos, end_pos))
found = true;
out << ", ";
- if (print_value_expr(out, node->right, relaxed, node_to_find, start_pos, end_pos))
+ if (node->right &&
+ print_value_expr(out, node->right, relaxed, node_to_find, start_pos, end_pos))
found = true;
break;
case value_expr_t::O_QUES: