]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcmatch.c
[fcmatch] Fix crash when no fonts are available.
[fontconfig.git] / src / fcmatch.c
index 556fffeaa85a6aba69d9819008c5a2fd90e4b0ad..b86cbbcd4058f8690e2790daa4aea4aee2e1f90f 100644 (file)
@@ -550,7 +550,10 @@ FcFontSetMatch (FcConfig    *config,
            return 0;
     }
     best = FcFontSetMatchInternal (config, sets, nsets, p, result);
-    return FcFontRenderPrepare (config, p, best);
+    if (best)
+       return FcFontRenderPrepare (config, p, best);
+    else
+       return NULL;
 }
 
 FcPattern *
@@ -575,7 +578,10 @@ FcFontMatch (FcConfig      *config,
        sets[nsets++] = config->fonts[FcSetApplication];
 
     best = FcFontSetMatchInternal (config, sets, nsets, p, result);
-    return FcFontRenderPrepare (config, p, best);
+    if (best)
+       return FcFontRenderPrepare (config, p, best);
+    else
+       return NULL;
 }
 
 typedef struct _FcSortNode {