If a comparison between amounts fails, fall back and try to compare

commodities instead.
This commit is contained in:
John Wiegley 2008-08-14 04:15:35 -04:00
parent 274552f2f9
commit e18749dec9

View file

@ -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;
}