]> git.wh0rd.org - fontconfig.git/commitdiff
[fcformat] Fix default-value handling
authorBehdad Esfahbod <behdad@behdad.org>
Fri, 13 Mar 2009 16:11:13 +0000 (12:11 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Fri, 13 Mar 2009 21:59:29 +0000 (17:59 -0400)
src/fcformat.c

index 99c4f858fcd31cd4c8643739863f899f2363d35d..5a05238e05077da54aa41c0b0816d534c2ac06c8 100644 (file)
@@ -737,9 +737,9 @@ interpret_simple (FcFormatContext *c,
 
     e = FcPatternObjectFindElt (pat,
                                FcObjectFromName ((const char *) c->word));
-    if (e)
+    if (e || else_string)
     {
-       FcValueListPtr l;
+       FcValueListPtr l = NULL;
 
        if (add_colon)
            FcStrBufChar (buf, ':');
@@ -749,7 +749,8 @@ interpret_simple (FcFormatContext *c,
            FcStrBufChar (buf, '=');
        }
 
-       l = FcPatternEltValues(e);
+       if (e)
+           l = FcPatternEltValues(e);
 
        if (idx != -1)
        {
@@ -765,16 +766,16 @@ interpret_simple (FcFormatContext *c,
            }
            else goto notfound;
         }
-       else
+       else if (l)
        {
            FcNameUnparseValueList (buf, l, '\0');
        }
-    }
-    else
-notfound:
-    {
-       if (else_string)
-           printf ("%s", else_string);
+       else
+       {
+    notfound:
+           if (else_string)
+               FcStrBufString (buf, else_string);
+       }
     }
 
     return FcTrue;