Check whether this_bal actually finds a matching commodity value, otherwise

it's a divide by zero.
This commit is contained in:
John Wiegley 2008-07-17 17:37:03 -04:00
parent 95f323f137
commit a2e16273f6

View file

@ -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.