From f6d83439890c165e5a7f6a8a746ffdb189dbbd0d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 13 Mar 2009 12:11:13 -0400 Subject: [PATCH] [fcformat] Fix default-value handling --- src/fcformat.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/fcformat.c b/src/fcformat.c index 99c4f85..5a05238 100644 --- a/src/fcformat.c +++ b/src/fcformat.c @@ -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;