1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-08 08:43:52 -08:00

Allow null entries in face and image cache

Problem reported by Tino Calancha (Bug#23580).
* src/dispextern.h (FACE_FROM_ID, IMAGE_FROM_ID):
Don’t assume that the result is non-null.
* src/xdisp.c (fill_image_glyph_string):
Restore check that image pointer is non-null.
This commit is contained in:
Paul Eggert 2016-05-19 08:38:55 -07:00
parent 4010897982
commit e8a28b295f
2 changed files with 1 additions and 2 deletions

View file

@ -1815,7 +1815,6 @@ struct face_cache
#define FACE_FROM_ID(F, ID) \
(eassert (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used)), \
eassume (FRAME_FACE_CACHE (F)->faces_by_id[ID]), \
FRAME_FACE_CACHE (F)->faces_by_id[ID])
/* Return a pointer to the face with ID on frame F, or null if such a
@ -3093,7 +3092,6 @@ struct image_cache
#define IMAGE_FROM_ID(F, ID) \
(eassert (UNSIGNED_CMP (ID, <, FRAME_IMAGE_CACHE (F)->used)), \
eassume (FRAME_IMAGE_CACHE (F)->images[ID]), \
FRAME_IMAGE_CACHE (F)->images[ID])
/* Value is a pointer to the image with id ID on frame F, or null if

View file

@ -24870,6 +24870,7 @@ fill_image_glyph_string (struct glyph_string *s)
{
eassert (s->first_glyph->type == IMAGE_GLYPH);
s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id);
eassert (s->img);
s->slice = s->first_glyph->slice.img;
s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
s->font = s->face->font;