From: Paul Eggert Date: Thu, 19 May 2016 15:38:55 +0000 (-0700) Subject: Allow null entries in face and image cache X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/e8a28b295fabbc249c5123b58fcf2beb82f08da2 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. --- diff --git a/src/dispextern.h b/src/dispextern.h index 4deebc146c..e83b7c7fc8 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -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 diff --git a/src/xdisp.c b/src/xdisp.c index e18af2fdf1..10a0cf24b4 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -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;