Check whether this_bal actually finds a matching commodity value, otherwise
it's a divide by zero.
This commit is contained in:
parent
95f323f137
commit
a2e16273f6
1 changed files with 19 additions and 17 deletions
|
|
@ -161,6 +161,7 @@ bool entry_base_t::finalize()
|
|||
if (this_bal == other_bal)
|
||||
other_bal++;
|
||||
|
||||
if (this_bal != ((balance_t *) balance.data)->amounts.end()) {
|
||||
amount_t per_unit_cost =
|
||||
amount_t((*other_bal).second / (*this_bal).second).unround();
|
||||
|
||||
|
|
@ -185,6 +186,7 @@ bool entry_base_t::finalize()
|
|||
balance += *(*x)->cost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Walk through each of the transactions, fixing up any that we
|
||||
// can, and performing any on-the-fly calculations.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue