Teach xaccSplitConvertAmount that 0*x = 0. Avoids looking up non-existant exchange rate.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18508 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Mike Alexander 2009-12-17 06:30:26 +00:00
parent 574385f9fd
commit 9b31a03191

View File

@ -1084,8 +1084,13 @@ xaccSplitConvertAmount (const Split *split, Account * account)
* compute the conversion rate (based on amount/value), and then multiply
* this times the split value.
*/
convrate = xaccTransGetAccountConvRate(txn, account);
value = xaccSplitGetValue (split);
if (gnc_numeric_zero_p (value)) {
return value;
}
convrate = xaccTransGetAccountConvRate(txn, account);
return gnc_numeric_mul (value, convrate,
gnc_commodity_get_fraction (to_commodity),
GNC_RND_ROUND);