From 0f60287f66c7a0586304709ae002249e092ef05e Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 15 Aug 2015 20:26:07 +0100 Subject: [PATCH] Stop multifont fallback from crashing in GTK1. I was tacitly assuming that mfont->fallback would always be non-NULL, which is true in a world containing Pango, but untrue in GTK1 when Pango isn't there. In that situation we fall back to just omitting the characters that would be displayed in the fallback font, on the grounds that that's better than dereferencing through a NULL vtable. --- unix/gtkfont.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/unix/gtkfont.c b/unix/gtkfont.c index 4fc19bf8..0bbdd39f 100644 --- a/unix/gtkfont.c +++ b/unix/gtkfont.c @@ -1631,6 +1631,7 @@ static void multifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font, int wide, int bold, int cellwidth) { struct multifont *mfont = (struct multifont *)font; + unifont *f; int ok, i; while (len > 0) { @@ -1647,8 +1648,10 @@ static void multifont_draw_text(GdkDrawable *target, GdkGC *gc, unifont *font, /* * Now display it. */ - unifont_draw_text(target, gc, ok ? mfont->main : mfont->fallback, - x, y, string, i, wide, bold, cellwidth); + f = ok ? mfont->main : mfont->fallback; + if (f) + unifont_draw_text(target, gc, f, x, y, string, i, wide, bold, + cellwidth); string += i; len -= i; x += i * cellwidth; -- 2.45.2