]> git.wh0rd.org - fontconfig.git/commitdiff
[fcmatch] Fix crash when no fonts are available.
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 23 Jan 2009 19:17:08 +0000 (14:17 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 15 Feb 2009 21:40:17 +0000 (13:40 -0800)
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 {