r15279 - gnucash/branches/2.0 - Return zero instead of failing an assertion when the register asks a
Derek Atkins
warlord at cvs.gnucash.org
Sat Dec 30 14:44:18 EST 2006
Author: warlord
Date: 2006-12-30 14:44:17 -0500 (Sat, 30 Dec 2006)
New Revision: 15279
Trac: http://svn.gnucash.org/trac/changeset/15279
Modified:
gnucash/branches/2.0/
gnucash/branches/2.0/ChangeLog
gnucash/branches/2.0/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.
Merge from r15179 and r15180
Property changes on: gnucash/branches/2.0
___________________________________________________________________
Name: svk:merge
- 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13761
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
+ 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/2.0:697
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/2.0:13797
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13282
Modified: gnucash/branches/2.0/ChangeLog
===================================================================
--- gnucash/branches/2.0/ChangeLog 2006-12-29 23:30:16 UTC (rev 15278)
+++ gnucash/branches/2.0/ChangeLog 2006-12-30 19:44:17 UTC (rev 15279)
@@ -1,3 +1,11 @@
+2006-12-30 Chris Shoemaker <chris.shoemaker at cox.net>
+
+ * 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.
+
2006-12-25 Andreas Köhler <andi5.py at gmx.net>
* Correct account compatibility check with top level account. #389317
Modified: gnucash/branches/2.0/src/engine/Split.c
===================================================================
--- gnucash/branches/2.0/src/engine/Split.c 2006-12-29 23:30:16 UTC (rev 15278)
+++ gnucash/branches/2.0/src/engine/Split.c 2006-12-30 19:44:17 UTC (rev 15279)
@@ -1068,11 +1068,20 @@
const Split *osplit = xaccSplitGetOtherSplit (split);
if (osplit)
- g_assert(gnc_commodity_equal(
- to_commodity,
- xaccAccountGetCommodity(xaccSplitGetAccount(osplit))));
- if (osplit)
- return gnc_numeric_neg (xaccSplitGetAmount (osplit));
+ {
+ gnc_commodity* split_comm =
+ xaccAccountGetCommodity(xaccSplitGetAccount(osplit));
+ if (!gnc_commodity_equal(to_commodity, split_comm))
+ {
+ PERR("The split's (%s) amount can't be converted from %s into %s.",
+ guid_to_string(xaccSplitGetGUID(osplit)),
+ gnc_commodity_get_mnemonic(split_comm),
+ gnc_commodity_get_mnemonic(to_commodity)
+ );
+ return gnc_numeric_zero();
+ }
+ return gnc_numeric_neg (xaccSplitGetAmount (osplit));
+ }
}
/* ... otherwise, we need to compute the amount from the conversion
More information about the gnucash-changes
mailing list