diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-03-16 19:17:19 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-03-16 19:17:19 +0300 |
commit | 5389964eea27c4d0129171ee69129210ee522bc3 (patch) | |
tree | a0cf3a3b6308289186a5ca7f4d7234734f4530c0 /source/blender/blenkernel/intern/icons.c | |
parent | 1a71d5ae85c8080705fc88188b6ef78aad29efdd (diff) |
Add an assert to BKE_icon_changed() that we are actually dealing with ID icon.
Otherwise, ID->obj is an opaque pointer, wrong usage here could lead to
a vast amount of bad things.
Diffstat (limited to 'source/blender/blenkernel/intern/icons.c')
-rw-r--r-- | source/blender/blenkernel/intern/icons.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/icons.c b/source/blender/blenkernel/intern/icons.c index d56d758d4f0..7302d62d20f 100644 --- a/source/blender/blenkernel/intern/icons.c +++ b/source/blender/blenkernel/intern/icons.c @@ -440,6 +440,9 @@ void BKE_icon_changed(const int icon_id) icon = BLI_ghash_lookup(gIcons, SET_INT_IN_POINTER(icon_id)); if (icon) { + /* We *only* expect ID-tied icons here, not non-ID icon/preview! */ + BLI_assert(icon->type != 0); + /* Do not enforce creation of previews for valid ID types using BKE_previewimg_id_ensure() here , * we only want to ensure *existing* preview images are properly tagged as changed/invalid, that's all. */ PreviewImage **p_prv = BKE_previewimg_id_get_p((ID *)icon->obj); |