From eb4730e0bf89ebc2e4e8cb3acf8eae053323f29d Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 20 Mar 2016 19:55:22 +0000 Subject: [PATCH] Fix blatant segfault in x11_font_has_glyph. When I cut it in half so I could fetch the XCharStruct for a given character, I forgot that the remaining half should check whether it had got NULL from the XCharStruct finder. Ahem. --- unix/gtkfont.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unix/gtkfont.c b/unix/gtkfont.c index 725b1d4b..a865121e 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -350,7 +350,7 @@ static int x11_font_has_glyph(XFontStruct *xfs, int byte1, int byte2) * which glyphs _are_ missing. */ const XCharStruct *xcs = x11_char_struct(xfs, byte1, byte2); - return (xcs->ascent + xcs->descent > 0 || xcs->width > 0); + return xcs && (xcs->ascent + xcs->descent > 0 || xcs->width > 0); } static unifont *x11font_create(GtkWidget *widget, const char *name,