[gimp] app: check that the font path is not NULL.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: check that the font path is not NULL.
- Date: Mon, 30 Apr 2018 20:06:24 +0000 (UTC)
commit 55d1ea5cf05a3acb22890cd63dca446dd8e9f8d9
Author: Jehan <jehan girinstud io>
Date: Mon Apr 30 22:02:31 2018 +0200
app: check that the font path is not NULL.
This is for Windows where we apparently need to call
g_win32_locale_filename_from_utf8() before feeding the path to
FcConfigAppFontAddFile().
Unfortunately as we discovered earlier (cf. commit ba06a0fe86), this
can sometimes return NULL. So we absolutely need to check for the path
not being NULL first.
app/text/gimp-fonts.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/app/text/gimp-fonts.c b/app/text/gimp-fonts.c
index 3660602..d708d87 100644
--- a/app/text/gimp-fonts.c
+++ b/app/text/gimp-fonts.c
@@ -307,10 +307,15 @@ gimp_fonts_recursive_add_fontdir (FcConfig *config,
gchar *tmp = g_win32_locale_filename_from_utf8 (path);
g_free (path);
+ /* XXX: g_win32_locale_filename_from_utf8() may return
+ * NULL. So we need to check that path is not NULL before
+ * trying to load with fontconfig.
+ */
path = tmp;
#endif
- if (FcFalse == FcConfigAppFontAddFile (config, (const FcChar8 *) path))
+ if (! path ||
+ FcFalse == FcConfigAppFontAddFile (config, (const FcChar8 *) path))
{
g_printerr ("%s: adding font file '%s' failed.\n",
G_STRFUNC, path);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]