r17874 - gnucash/branches/2.2/src/backend/file - [17866] Bug #438132: Fix warning about commodity being NULL for root account on save
Christian Stimming
cstim at cvs.gnucash.org
Tue Feb 3 16:05:15 EST 2009
Author: cstim
Date: 2009-02-03 16:05:15 -0500 (Tue, 03 Feb 2009)
New Revision: 17874
Trac: http://svn.gnucash.org/trac/changeset/17874
Modified:
gnucash/branches/2.2/src/backend/file/gnc-account-xml-v2.c
Log:
[17866] 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.
Original commit by cstim.
Modified: gnucash/branches/2.2/src/backend/file/gnc-account-xml-v2.c
===================================================================
--- gnucash/branches/2.2/src/backend/file/gnc-account-xml-v2.c 2009-02-03 21:05:07 UTC (rev 17873)
+++ gnucash/branches/2.2/src/backend/file/gnc-account-xml-v2.c 2009-02-03 21:05:15 UTC (rev 17874)
@@ -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