From d6274fee19143554f232c9d0d78263bbd19efaed Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Mon, 19 Mar 2012 00:30:15 -0500 Subject: Extend commodity_t::compare_by_commodity::operator() --- src/commodity.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/commodity.cc') diff --git a/src/commodity.cc b/src/commodity.cc index 0dad9a1a..5335d8a8 100644 --- a/src/commodity.cc +++ b/src/commodity.cc @@ -481,6 +481,15 @@ bool commodity_t::compare_by_commodity::operator()(const amount_t * left, if (aleftcomm.details.tag && arightcomm.details.tag) return *aleftcomm.details.tag < *arightcomm.details.tag; + if (! aleftcomm.details.value_expr && arightcomm.details.value_expr) + return true; + if (aleftcomm.details.value_expr && ! arightcomm.details.value_expr) + return false; + + if (aleftcomm.details.value_expr && arightcomm.details.value_expr) + return (aleftcomm.details.value_expr->text() < + arightcomm.details.value_expr->text()); + assert(false); return true; } -- cgit v1.2.3