]> code.delx.au - gnu-emacs/commitdiff
Allow null entries in face and image cache
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 19 May 2016 15:38:55 +0000 (08:38 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 19 May 2016 15:39:20 +0000 (08:39 -0700)
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.

src/dispextern.h
src/xdisp.c

index 4deebc146c82aaf31c38a0b34f5eebad42720117..e83b7c7fc83e75dba2564819875c5734c299a161 100644 (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
index e18af2fdf1d9ae12eed057b36bfd4608a9e995ce..10a0cf24b4aa46bec148bff4d0ac98c9fe87bbca 100644 (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;