From 4e43c3563b4527e612898ca52d8f749b1aef27b2 Mon Sep 17 00:00:00 2001 From: krypt-n Date: Thu, 20 Nov 2014 22:00:11 +0100 Subject: [PATCH] Fixes crash related to last fix --- bar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bar.c b/bar.c index 9607cf2..3625533 100644 --- a/bar.c +++ b/bar.c @@ -450,7 +450,7 @@ select_drawable_font (const wchar_t c) */ for (int i = 0; font_list[i] != NULL; i++) { font_t *font = font_list[i]; - if ((c >= font->char_min && c <= font->char_max && + if ((font->ptr && c >= font->char_min && c <= font->char_max && font->width_lut[c - font->char_min].character_width != 0)|| (font->xft_ft && XftCharExists(dpy, font->xft_ft, (FcChar32) c))) return font; @@ -639,6 +639,7 @@ font_load (const char *str) queryreq = xcb_query_font(c, font); font_info = xcb_query_font_reply(c, queryreq, NULL); + ret->xft_ft = NULL; ret->ptr = font; ret->descent = font_info->font_descent; ret->height = font_info->font_ascent + font_info->font_descent; @@ -646,6 +647,7 @@ font_load (const char *str) ret->char_min = font_info->min_byte1 << 8 | font_info->min_char_or_byte2; ret->width_lut = xcb_query_font_char_infos(font_info); } else if ((ret->xft_ft = XftFontOpenName (dpy, scr_nbr, str))) { + ret->ptr = 0; ret->ascent = ret->xft_ft->ascent; ret->descent = ret->xft_ft->descent; ret->height = ret->ascent + ret->descent;