AUDIT: r17866 - gnucash/trunk/src/backend/file - Bug #438132: Fix warning about commodity being NULL for root account on save
Christian Stimming
cstim at cvs.gnucash.org
Sat Jan 31 14:49:55 EST 2009
Author: cstim
Date: 2009-01-31 14:49:55 -0500 (Sat, 31 Jan 2009)
New Revision: 17866
Trac: http://svn.gnucash.org/trac/changeset/17866
Modified:
gnucash/trunk/src/backend/file/gnc-account-xml-v2.c
Log:
Bug #438132: Fix warning about commodity being NULL for root account on save
This patch doesn't write the commodity, the commodity SCU, or the non-standard
SCU setting for an account that has no commodity.
Patch by Mike Alexander.
BP
Modified: gnucash/trunk/src/backend/file/gnc-account-xml-v2.c
===================================================================
--- gnucash/trunk/src/backend/file/gnc-account-xml-v2.c 2009-01-31 19:49:49 UTC (rev 17865)
+++ gnucash/trunk/src/backend/file/gnc-account-xml-v2.c 2009-01-31 19:49:55 UTC (rev 17866)
@@ -79,6 +79,7 @@
xmlNodePtr ret;
GList *lots, *n;
Account *parent;
+ gnc_commodity *acct_commodity;
ENTER ("(account=%p)", act);
@@ -94,14 +95,18 @@
act_type_string,
xaccAccountTypeEnumAsString(xaccAccountGetType(act))));
- xmlAddChild(ret, commodity_ref_to_dom_tree(act_commodity_string,
- xaccAccountGetCommodity(act)));
-
- xmlAddChild(ret, int_to_dom_tree(act_commodity_scu_string,
- xaccAccountGetCommoditySCUi(act)));
+ acct_commodity = xaccAccountGetCommodity(act);
+ if (acct_commodity != NULL)
+ {
+ xmlAddChild(ret, commodity_ref_to_dom_tree(act_commodity_string,
+ acct_commodity));
- if (xaccAccountGetNonStdSCU(act))
- xmlNewChild(ret, NULL, BAD_CAST act_non_standard_scu_string, NULL);
+ xmlAddChild(ret, int_to_dom_tree(act_commodity_scu_string,
+ xaccAccountGetCommoditySCUi(act)));
+
+ if (xaccAccountGetNonStdSCU(act))
+ xmlNewChild(ret, NULL, BAD_CAST act_non_standard_scu_string, NULL);
+ }
str = xaccAccountGetCode(act);
if (str && strlen(str) > 0)
More information about the gnucash-changes
mailing list