[Fontconfig] [fc-match] 'fc-match --all' core dumps when no fonts are installed.#40453

Arvind Umrao arvind.umrao at oracle.com
Fri Sep 2 02:42:30 PDT 2011


https://bugs.freedesktop.org/show_bug.cgi?id=40453

Running 'fc-match --all' core dumps when no fonts are installed. 
FcFontSort interface returns Null, when no fonts are installed. Put a 
check for Null condition at fc-match

Signed-off-by: Arvind Umrao <arvind.umrao at oracle.com>
---
  fc-match/fc-match.c |    6 ++++++
  1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
index e64b4bc..8b59896 100644
--- a/fc-match/fc-match.c
+++ b/fc-match/fc-match.c
@@ -175,6 +175,12 @@ main (int argc, char **argv)
  	int	j;
  	font_patterns = FcFontSort (0, pat, all ? FcFalse : FcTrue, 0, &result);

+	if (!font_patterns)
+	{
+	    fprintf (stderr, "Can't find any matching font\n");
+	    return 1;
+	}
+
  	for (j = 0; j < font_patterns->nfont; j++)
  	{
  	    FcPattern  *font_pattern;
-- 1.7.6


More information about the Fontconfig mailing list