From 6582c6b95b853beff72c142a2154b2c58d73e0f8 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Sun, 22 Apr 2007 19:29:53 +0000 Subject: [PATCH] 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. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@15988 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/Account.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/engine/Account.c b/src/engine/Account.c index 03cf53e6dd..63581b4391 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -3255,6 +3255,8 @@ xaccAccountGetXxxBalanceInCurrencyRecursive (const Account *acc, 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 @@ xaccAccountGetXxxBalanceAsOfDateInCurrencyRecursive ( 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);