AUDIT: r15179 - gnucash/trunk/src/engine - Return zero instead of failing an assertion when the register asks a
Chris Shoemaker
chris at cvs.gnucash.org
Sun Dec 3 21:20:02 EST 2006
Author: chris
Date: 2006-12-03 21:20:01 -0500 (Sun, 03 Dec 2006)
New Revision: 15179
Trac: http://svn.gnucash.org/trac/changeset/15179
Modified:
gnucash/trunk/src/engine/Split.c
Log:
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
Modified: gnucash/trunk/src/engine/Split.c
===================================================================
--- gnucash/trunk/src/engine/Split.c 2006-12-03 02:10:26 UTC (rev 15178)
+++ gnucash/trunk/src/engine/Split.c 2006-12-04 02:20:01 UTC (rev 15179)
@@ -1068,9 +1068,12 @@
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));
}
More information about the gnucash-changes
mailing list