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)
This commit is contained in:
Eli Zaretskii 2025-01-21 14:24:57 +02:00
parent 0e3687e600
commit 7738641205

View file

@ -6111,7 +6111,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); struct face *face = FACE_FROM_ID (it->f, it->face_id);
it->voffset = - (XFLOATINT (value) 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 */ #endif /* HAVE_WINDOW_SYSTEM */
} }
@ -32056,7 +32058,8 @@ produce_stretch_glyph (struct it *it)
/* Compute height. */ /* Compute height. */
if (FRAME_WINDOW_P (it->f)) 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)) if ((prop = plist_get (plist, QCheight), !NILP (prop))
&& calc_pixel_width_or_height (&tem, it, prop, font, false, NULL)) && calc_pixel_width_or_height (&tem, it, prop, font, false, NULL))