Prevent a crash if gnc_sx_sxes_reverencing_account called when book has no sxes.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20146 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
John Ralls 2011-01-22 22:59:42 +00:00
parent dc4ae21d0b
commit 79ee7e78ac

View File

@ -362,8 +362,10 @@ gnc_sx_get_sxes_referencing_account(QofBook *book, Account *acct)
{ {
GList *rtn = NULL; GList *rtn = NULL;
const GncGUID *acct_guid = qof_entity_get_guid(QOF_INSTANCE(acct)); const GncGUID *acct_guid = qof_entity_get_guid(QOF_INSTANCE(acct));
GList *sx_list = gnc_book_get_schedxactions(book)->sx_list; GList *sx_list;
for (; sx_list != NULL; sx_list = sx_list->next) 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; SchedXaction *sx = (SchedXaction*)sx_list->data;
GList *splits = xaccSchedXactionGetSplits(sx); GList *splits = xaccSchedXactionGetSplits(sx);