diff options
author | John Wiegley <johnw@newartisans.com> | 2008-08-14 04:15:35 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2008-08-14 04:15:35 -0400 |
commit | e18749dec9bb2ab9d041ec231e56768e39623b00 (patch) | |
tree | 3512f580b0a3b8e27dfd94b7ed03ca4c77503ae0 | |
parent | 274552f2f9df38590dae213619160aae9219179e (diff) | |
download | fork-ledger-e18749dec9bb2ab9d041ec231e56768e39623b00.tar.gz fork-ledger-e18749dec9bb2ab9d041ec231e56768e39623b00.tar.bz2 fork-ledger-e18749dec9bb2ab9d041ec231e56768e39623b00.zip |
If a comparison between amounts fails, fall back and try to compare
commodities instead.
-rw-r--r-- | src/value.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/value.cc b/src/value.cc index 5a0c7e70..660c7663 100644 --- a/src/value.cc +++ b/src/value.cc @@ -967,7 +967,12 @@ bool value_t::operator<(const value_t& val) const case INTEGER: return as_amount() < val.as_long(); case AMOUNT: - return as_amount() < val.as_amount(); + try { + return as_amount() < val.as_amount(); + } + catch (const amount_error&) { + return compare_amount_commodities()(&as_amount(), &val.as_amount()); + } default: break; } |