From 0e6d1909b81561c2a911ef12488c17c5c581096a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Tarl=C3=A1=20Cardoso=20Lemos?= Date: Sun, 27 Nov 2011 17:45:24 -0200 Subject: [PATCH] Handle the case where there's no font char infos. Fixes i3bar crash with some fonts (and possible i3 crash too). Thanks to xeen for reporting the issue. --- libi3/font.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libi3/font.c b/libi3/font.c index 5dfdf3d3..3a68cb78 100644 --- a/libi3/font.c +++ b/libi3/font.c @@ -64,7 +64,10 @@ i3Font load_font(const char *pattern, const bool fallback) { errx(EXIT_FAILURE, "Could not load font \"%s\"", pattern); /* Get the font table, if possible */ - font.table = xcb_query_font_char_infos(font.info); + if (xcb_query_font_char_infos_length(font.info) == 0) + font.table = NULL; + else + font.table = xcb_query_font_char_infos(font.info); /* Calculate the font height */ font.height = font.info->font_ascent + font.info->font_descent;