gnucash maint: [gnc-report] Handle default_font_family being NULL

Christopher Lam clam at code.gnucash.org
Sat Jul 31 09:16:23 EDT 2021


Updated	 via  https://github.com/Gnucash/gnucash/commit/b9d6fc9f (commit)
	from  https://github.com/Gnucash/gnucash/commit/b8dad64b (commit)



commit b9d6fc9f4f0e7557efe27259c37b992ecbcf3664
Author: Christopher Lam <christopher.lck at gmail.com>
Date:   Sat Jul 31 21:11:56 2021 +0800

    [gnc-report] Handle default_font_family being NULL
    
    There was invalid assumption in afea6fd68. According to the following
    documentation, pango_font_description_get_family can return NULL, and
    g_strdup (NULL) also returns NULL.
    
    https://docs.gtk.org/Pango/method.FontDescription.get_family.html

diff --git a/gnucash/report/gnc-report.c b/gnucash/report/gnc-report.c
index 970133867..96727e96f 100644
--- a/gnucash/report/gnc-report.c
+++ b/gnucash/report/gnc-report.c
@@ -336,7 +336,9 @@ gnc_get_default_report_font_family(void)
 
     pango_font_description_free (font_desc);
 
-    if (g_str_has_prefix (default_font_family, ".AppleSystemUIFont"))
+    if (!default_font_family)
+        return g_strdup ("Arial");
+    else if (g_str_has_prefix (default_font_family, ".AppleSystemUIFont"))
     {
         g_free (default_font_family);
         return g_strdup ("Arial");



Summary of changes:
 gnucash/report/gnc-report.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list