summaryrefslogtreecommitdiff
path: root/src/commodity.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/commodity.cc')
-rw-r--r--src/commodity.cc9
1 files changed, 9 insertions, 0 deletions
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;
}