From b9d6fc9f4f0e7557efe27259c37b992ecbcf3664 Mon Sep 17 00:00:00 2001 From: Christopher Lam Date: Sat, 31 Jul 2021 21:11:56 +0800 Subject: [PATCH] [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 --- gnucash/report/gnc-report.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gnucash/report/gnc-report.c b/gnucash/report/gnc-report.c index 9701338676..96727e96fe 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");