aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2016-05-19 08:38:55 -0700
committerPaul Eggert2016-05-19 08:39:20 -0700
commite8a28b295fabbc249c5123b58fcf2beb82f08da2 (patch)
tree6b5f7de8eb459910d4bb3358962ed09c344fc1f1
parent40108979821637104d2ece39af8a27068544d3bd (diff)
downloademacs-e8a28b295fabbc249c5123b58fcf2beb82f08da2.tar.gz
emacs-e8a28b295fabbc249c5123b58fcf2beb82f08da2.zip
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.
-rw-r--r--src/dispextern.h2
-rw-r--r--src/xdisp.c1
2 files changed, 1 insertions, 2 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 4deebc146c8..e83b7c7fc83 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1815,7 +1815,6 @@ struct face_cache
1815 1815
1816#define FACE_FROM_ID(F, ID) \ 1816#define FACE_FROM_ID(F, ID) \
1817 (eassert (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used)), \ 1817 (eassert (UNSIGNED_CMP (ID, <, FRAME_FACE_CACHE (F)->used)), \
1818 eassume (FRAME_FACE_CACHE (F)->faces_by_id[ID]), \
1819 FRAME_FACE_CACHE (F)->faces_by_id[ID]) 1818 FRAME_FACE_CACHE (F)->faces_by_id[ID])
1820 1819
1821/* Return a pointer to the face with ID on frame F, or null if such a 1820/* Return a pointer to the face with ID on frame F, or null if such a
@@ -3093,7 +3092,6 @@ struct image_cache
3093 3092
3094#define IMAGE_FROM_ID(F, ID) \ 3093#define IMAGE_FROM_ID(F, ID) \
3095 (eassert (UNSIGNED_CMP (ID, <, FRAME_IMAGE_CACHE (F)->used)), \ 3094 (eassert (UNSIGNED_CMP (ID, <, FRAME_IMAGE_CACHE (F)->used)), \
3096 eassume (FRAME_IMAGE_CACHE (F)->images[ID]), \
3097 FRAME_IMAGE_CACHE (F)->images[ID]) 3095 FRAME_IMAGE_CACHE (F)->images[ID])
3098 3096
3099/* Value is a pointer to the image with id ID on frame F, or null if 3097/* 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 e18af2fdf1d..10a0cf24b4a 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -24870,6 +24870,7 @@ fill_image_glyph_string (struct glyph_string *s)
24870{ 24870{
24871 eassert (s->first_glyph->type == IMAGE_GLYPH); 24871 eassert (s->first_glyph->type == IMAGE_GLYPH);
24872 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id); 24872 s->img = IMAGE_FROM_ID (s->f, s->first_glyph->u.img_id);
24873 eassert (s->img);
24873 s->slice = s->first_glyph->slice.img; 24874 s->slice = s->first_glyph->slice.img;
24874 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id); 24875 s->face = FACE_FROM_ID (s->f, s->first_glyph->face_id);
24875 s->font = s->face->font; 24876 s->font = s->face->font;