diff options
-rw-r--r-- | src/value.cc | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/value.cc b/src/value.cc index 4ccfad81..5d32f8b7 100644 --- a/src/value.cc +++ b/src/value.cc @@ -788,19 +788,19 @@ bool value_t::is_less_than(const value_t& val) const case BALANCE: switch (val.type()) { case INTEGER: - if (val.as_long() != 0) - break; - // fall through... - case AMOUNT: + case AMOUNT: { if (val.is_nonzero()) break; + bool no_amounts = true; foreach (const balance_t::amounts_map::value_type& pair, as_balance().amounts) { - if (pair.second > 0L) + if (pair.second >= 0L) return false; + no_amounts = false; } - return true; + return ! no_amounts; + } default: break; } @@ -858,19 +858,19 @@ bool value_t::is_greater_than(const value_t& val) const case BALANCE: switch (val.type()) { case INTEGER: - if (val.as_long() != 0) - break; - // fall through... - case AMOUNT: + case AMOUNT: { if (val.is_nonzero()) break; + bool no_amounts = true; foreach (const balance_t::amounts_map::value_type& pair, as_balance().amounts) { - if (pair.second < 0L) + if (pair.second <= 0L) return false; + no_amounts = false; } - return true; + return ! no_amounts; + } default: break; } |