Return zero instead of failing an assertion when the register asks a

Split for its amount in a commodity that is not involved in the split's
transaction.  This will prevent the crash in bug #379625, but doesn't solve
the underlying problem, which is a bug in the register.
BP


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15179 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Chris Shoemaker
2006-12-04 02:20:01 +00:00
parent 099867608e
commit e8e2e12e11
+6 -3
View File
@@ -1068,9 +1068,12 @@ xaccSplitConvertAmount (const Split *split, Account * account)
const Split *osplit = xaccSplitGetOtherSplit (split);
if (osplit)
g_assert(gnc_commodity_equal(
to_commodity,
xaccAccountGetCommodity(xaccSplitGetAccount(osplit))));
if (!gnc_commodity_equal(
to_commodity,
xaccAccountGetCommodity(xaccSplitGetAccount(osplit)))) {
PERR("The split's amount can't be converted into this commodity.");
return gnc_numeric_zero();
}
if (osplit)
return gnc_numeric_neg (xaccSplitGetAmount (osplit));
}