AUDIT: r15180 - gnucash/trunk - Print out more information about "broken" splits.

Derek Atkins warlord at cvs.gnucash.org
Sun Dec 3 22:09:25 EST 2006


Author: warlord
Date: 2006-12-03 22:09:24 -0500 (Sun, 03 Dec 2006)
New Revision: 15180
Trac: http://svn.gnucash.org/trac/changeset/15180

Modified:
   gnucash/trunk/
   gnucash/trunk/src/engine/Split.c
Log:
Print out more information about "broken" splits.
Extends r15179 which should fix the crash of bug #379625
NOTE: it now prints zeros, which could confuse the user...
BP



Property changes on: gnucash/trunk
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:943
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13603
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:943
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:13679
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366

Modified: gnucash/trunk/src/engine/Split.c
===================================================================
--- gnucash/trunk/src/engine/Split.c	2006-12-04 02:20:01 UTC (rev 15179)
+++ gnucash/trunk/src/engine/Split.c	2006-12-04 03:09:24 UTC (rev 15180)
@@ -1068,14 +1068,20 @@
     const Split *osplit = xaccSplitGetOtherSplit (split);
 
     if (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();
+    {
+        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();
         }
-    if (osplit)
-      return gnc_numeric_neg (xaccSplitGetAmount (osplit));
+        return gnc_numeric_neg (xaccSplitGetAmount (osplit));
+    }
   }
 
   /* ... otherwise, we need to compute the amount from the conversion



More information about the gnucash-changes mailing list