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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig


[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux