From 2e5eee750f31106ae5fc9f7f6f85225fad8a3054 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 21 Jan 2025 14:24:57 +0200 Subject: [PATCH] Avoid crashes in redisplay due to problematic font setups * src/xdisp.c (handle_single_display_spec) (produce_stretch_glyph): Avoid crashes if a face's font is NULL. (Bug#75725) (cherry picked from commit 77386412050fa348940bf83c5d736ff7b745d5d8) --- src/xdisp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 51b0ecf0405..f030628124a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -6194,7 +6194,9 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, { struct face *face = FACE_FROM_ID (it->f, it->face_id); it->voffset = - (XFLOATINT (value) - * (normal_char_height (face->font, -1))); + * (face->font + ? normal_char_height (face->font, -1) + : FRAME_LINE_HEIGHT (it->f))); } #endif /* HAVE_WINDOW_SYSTEM */ } @@ -32147,7 +32149,8 @@ produce_stretch_glyph (struct it *it) /* Compute height. */ if (FRAME_WINDOW_P (it->f)) { - int default_height = normal_char_height (font, ' '); + int default_height = + font ? normal_char_height (font, ' ') : FRAME_LINE_HEIGHT (it->f); if ((prop = plist_get (plist, QCheight), !NILP (prop)) && calc_pixel_width_or_height (&tem, it, prop, font, false, NULL)) -- 2.39.5