]> granicus.if.org Git - libass/commitdiff
fontselect: check fontprovider constructors for failure
authorwm4 <wm4@nowhere>
Thu, 27 Aug 2015 18:46:11 +0000 (20:46 +0200)
committerwm4 <wm4@nowhere>
Fri, 28 Aug 2015 12:06:50 +0000 (14:06 +0200)
Should fix the DirectWrite to Fontconfig fallback.

libass/ass_fontselect.c

index 1eae986f965383ea9dc26ea1cb5b303a39f65fe8..a15d0ded79a77a8bf208a279e0f1d63e1fdc2dbd 100644 (file)
@@ -911,16 +911,16 @@ ass_fontselect_init(ASS_Library *library,
     }
 
     if (dfp >= ASS_FONTPROVIDER_AUTODETECT) {
-        int found = 0;
-        for (int i = 0; !found && font_constructors[i].constructor; i++ )
+        for (int i = 0; font_constructors[i].constructor; i++ )
             if (dfp == font_constructors[i].id ||
                 dfp == ASS_FONTPROVIDER_AUTODETECT) {
                 priv->default_provider =
                     font_constructors[i].constructor(library, priv, config);
-                found = 1;
+                if (priv->default_provider)
+                    break;
             }
 
-        if (!found)
+        if (!priv->default_provider)
             ass_msg(library, MSGL_WARN, "can't find selected font provider");
 
     }