If a comparison between amounts fails, fall back and try to compare
commodities instead.
This commit is contained in:
parent
274552f2f9
commit
e18749dec9
1 changed files with 6 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue