r23496 - gnucash/trunk/src - Protect against null account pointers in a couple of place to avoid asserts.

Mike Alexander mta at code.gnucash.org
Sat Dec 7 02:33:25 EST 2013


Author: mta
Date: 2013-12-07 02:33:24 -0500 (Sat, 07 Dec 2013)
New Revision: 23496
Trac: http://svn.gnucash.org/trac/changeset/23496

Modified:
   gnucash/trunk/src/engine/Transaction.c
   gnucash/trunk/src/report/business-reports/balsheet-eg.scm
Log:
Protect against null account pointers in a couple of place to avoid asserts.

Modified: gnucash/trunk/src/engine/Transaction.c
===================================================================
--- gnucash/trunk/src/engine/Transaction.c	2013-12-07 07:33:14 UTC (rev 23495)
+++ gnucash/trunk/src/engine/Transaction.c	2013-12-07 07:33:24 UTC (rev 23496)
@@ -1054,7 +1054,8 @@
            the other. */
         FOR_EACH_SPLIT(trans, 
         {
-            if (xaccAccountGetType(xaccSplitGetAccount(s)) != ACCT_TYPE_TRADING)
+            Account *acc = xaccSplitGetAccount(s);
+            if (!acc || xaccAccountGetType(acc) != ACCT_TYPE_TRADING)
             {
                 imbal = gnc_numeric_add(imbal, xaccSplitGetValue(s),
                                         GNC_DENOM_AUTO, GNC_HOW_DENOM_EXACT);

Modified: gnucash/trunk/src/report/business-reports/balsheet-eg.scm
===================================================================
--- gnucash/trunk/src/report/business-reports/balsheet-eg.scm	2013-12-07 07:33:14 UTC (rev 23495)
+++ gnucash/trunk/src/report/business-reports/balsheet-eg.scm	2013-12-07 07:33:24 UTC (rev 23496)
@@ -536,7 +536,8 @@
                         (depth   (flattened-acc-depth account))
                         (treedepth 1)
                         ; Next account only qualifies as 'deeper' if we're not flattening
-                        (next-acc-deeper (> (flattened-acc-depth (safe-cadr account-list)) depth))
+                        (next-acc-deeper (and (not (null? (safe-cadr account-list)))
+                                              (> (flattened-acc-depth (safe-cadr account-list)) depth)))
                         (newacc (newaccrec-clean)))
                    (accrec-set-account!      newacc account)
                    (accrec-set-code!         newacc (xaccAccountGetCode account))



More information about the gnucash-changes mailing list