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
zzzoldfeatures/gobject-engine-dev
Chris Shoemaker 20 years ago
parent 099867608e
commit e8e2e12e11

@ -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));
}

Loading…
Cancel
Save