From ebb462d06d75c62375c48eca9743fdcdd96c8392 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Thu, 9 Jul 2020 21:19:27 +0800 Subject: [PATCH] [account.cpp] prevent crash in gnc_account_get_currency_or_parent if the *account argument is NULL, it is not reasonable to have a g_assert crash. Passing NULL account returns NULL commodity instead. --- libgnucash/engine/Account.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgnucash/engine/Account.cpp b/libgnucash/engine/Account.cpp index 00ba69a577..7654beee31 100644 --- a/libgnucash/engine/Account.cpp +++ b/libgnucash/engine/Account.cpp @@ -3271,7 +3271,7 @@ xaccAccountGetCommodity (const Account *acc) gnc_commodity * gnc_account_get_currency_or_parent(const Account* account) { gnc_commodity * commodity; - g_assert(account); + g_return_val_if_fail (account, NULL); commodity = xaccAccountGetCommodity (account); if (gnc_commodity_is_currency(commodity))