r15988 - gnucash/trunk/src/engine - Catch and short circuit the case of trying to get the balance of an account

David Hampton hampton at cvs.gnucash.org
Sun Apr 22 15:29:53 EDT 2007


Author: hampton
Date: 2007-04-22 15:29:53 -0400 (Sun, 22 Apr 2007)
New Revision: 15988
Trac: http://svn.gnucash.org/trac/changeset/15988

Modified:
   gnucash/trunk/src/engine/Account.c
Log:
Catch and short circuit the case of trying to get the balance of an account
that is so new it hasn't had a currency assigned yet.  Fixes #432227.


Modified: gnucash/trunk/src/engine/Account.c
===================================================================
--- gnucash/trunk/src/engine/Account.c	2007-04-22 18:30:48 UTC (rev 15987)
+++ gnucash/trunk/src/engine/Account.c	2007-04-22 19:29:53 UTC (rev 15988)
@@ -3255,6 +3255,8 @@
   if (!acc) return gnc_numeric_zero ();
   if (!report_commodity)
     report_commodity = xaccAccountGetCommodity (acc);
+  if (!report_commodity)
+    return gnc_numeric_zero();
 
   balance = xaccAccountGetXxxBalanceInCurrency (acc, fn, report_commodity);
 
@@ -3280,6 +3282,8 @@
   g_return_val_if_fail(acc, gnc_numeric_zero());
   if (!report_commodity)
       report_commodity = xaccAccountGetCommodity (acc);
+  if (!report_commodity)
+    return gnc_numeric_zero();
 
   balance = xaccAccountGetXxxBalanceAsOfDateInCurrency(
       acc, date, fn, report_commodity);



More information about the gnucash-changes mailing list