From e8e2e12e117012ddf81052809ba097c189a052e2 Mon Sep 17 00:00:00 2001 From: Chris Shoemaker Date: Mon, 4 Dec 2006 02:20:01 +0000 Subject: [PATCH] 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 --- src/engine/Split.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/engine/Split.c b/src/engine/Split.c index 7e620383e8..5b1fddf6ad 100644 --- a/src/engine/Split.c +++ b/src/engine/Split.c @@ -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)); }