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.
This commit is contained in:
Jehan
2018-04-30 22:02:31 +02:00
parent 69f864d5f5
commit 55d1ea5cf0

View File

@ -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);