diff options
Diffstat (limited to 'src/compare.cc')
-rw-r--r-- | src/compare.cc | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/compare.cc b/src/compare.cc index f3c13cea..12114c7d 100644 --- a/src/compare.cc +++ b/src/compare.cc @@ -39,11 +39,13 @@ namespace ledger { void push_sort_value(std::list<sort_value_t>& sort_values, - expr_t::ptr_op_t node, scope_t& scope) + expr_t::ptr_op_t node, scope_t& scope) { if (node->kind == expr_t::op_t::O_CONS) { - push_sort_value(sort_values, node->left(), scope); - push_sort_value(sort_values, node->right(), scope); + while (node && node->kind == expr_t::op_t::O_CONS) { + push_sort_value(sort_values, node->left(), scope); + node = node->right(); + } } else { bool inverted = false; @@ -54,11 +56,11 @@ void push_sort_value(std::list<sort_value_t>& sort_values, sort_values.push_back(sort_value_t()); sort_values.back().inverted = inverted; - sort_values.back().value = expr_t(node).calc(scope).simplified(); + sort_values.back().value = expr_t(node).calc(scope).simplified(); if (sort_values.back().value.is_null()) throw_(calc_error, - _("Could not determine sorting value based an expression")); + _("Could not determine sorting value based an expression")); } } @@ -106,7 +108,7 @@ bool compare_items<account_t>::operator()(account_t * left, account_t * right) } DEBUG("value.sort", "Comparing accounts " << left->fullname() - << " <> " << right->fullname()); + << " <> " << right->fullname()); return sort_value_is_less_than(lxdata.sort_values, rxdata.sort_values); } |