gnucash stable: Bug 799300 - Nullpointer exception in gnc_quote_source_s

Christopher Lam clam at code.gnucash.org
Fri May 3 20:28:00 EDT 2024


Updated	 via  https://github.com/Gnucash/gnucash/commit/949c9c97 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d358998a (commit)



commit 949c9c97c0362316ebaa9fe90c4e4089451ffdf1
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat May 4 08:26:11 2024 +0800

    Bug 799300 - Nullpointer exception in gnc_quote_source_s
    
    avoids constructing std::string with nullptr

diff --git a/libgnucash/engine/gnc-commodity.cpp b/libgnucash/engine/gnc-commodity.cpp
index a1d35aeb33..1bbef638a1 100644
--- a/libgnucash/engine/gnc-commodity.cpp
+++ b/libgnucash/engine/gnc-commodity.cpp
@@ -162,8 +162,8 @@ public:
                         const char* username, const char* int_name)
         : m_supported{supported}
         , m_type{type}
-        , m_user_name{username}
-        , m_internal_name{int_name} { };
+        , m_user_name{username ? username : ""}
+        , m_internal_name{int_name ? int_name: ""} { };
 };
 
 using QuoteSourceVec = std::vector<gnc_quote_source>;



Summary of changes:
 libgnucash/engine/gnc-commodity.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)



More information about the gnucash-changes mailing list