r20146 - gnucash/trunk/src/engine - Prevent a crash if gnc_sx_sxes_reverencing_account called when book has no sxes.

John Ralls jralls at code.gnucash.org
Sat Jan 22 17:59:42 EST 2011


Author: jralls
Date: 2011-01-22 17:59:42 -0500 (Sat, 22 Jan 2011)
New Revision: 20146
Trac: http://svn.gnucash.org/trac/changeset/20146

Modified:
   gnucash/trunk/src/engine/SX-book.c
Log:
Prevent a crash if gnc_sx_sxes_reverencing_account called when book has no sxes.

Modified: gnucash/trunk/src/engine/SX-book.c
===================================================================
--- gnucash/trunk/src/engine/SX-book.c	2011-01-22 14:39:56 UTC (rev 20145)
+++ gnucash/trunk/src/engine/SX-book.c	2011-01-22 22:59:42 UTC (rev 20146)
@@ -362,8 +362,10 @@
 {
     GList *rtn = NULL;
     const GncGUID *acct_guid = qof_entity_get_guid(QOF_INSTANCE(acct));
-    GList *sx_list = gnc_book_get_schedxactions(book)->sx_list;
-    for (; sx_list != NULL; sx_list = sx_list->next)
+    GList *sx_list;
+    SchedXactions *sxactions = gnc_book_get_schedxactions(book);
+    g_return_val_if_fail( sxactions != NULL, rtn);
+    for (sx_list = sxactions->sx_list; sx_list != NULL; sx_list = sx_list->next)
     {
         SchedXaction *sx = (SchedXaction*)sx_list->data;
         GList *splits = xaccSchedXactionGetSplits(sx);



More information about the gnucash-changes mailing list