diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-09-10 15:56:45 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-09-10 17:00:24 +0400 |
commit | 64e955f52228b573aeffb96d0b74db8eb6931190 (patch) | |
tree | 56c10abe206c96d87969d3989e3a190cdbfbf3e1 /source/blender/makesrna | |
parent | 20d6b792a49fe0693e6ebfb05bbec3ce4d2b3930 (diff) |
Fix crash in active_paint_texture_index callback
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_material.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c index 37b6947cfac..2e0ad63f48e 100644 --- a/source/blender/makesrna/intern/rna_material.c +++ b/source/blender/makesrna/intern/rna_material.c @@ -195,14 +195,17 @@ static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *s nodeSetActive(ma->nodetree, node); } - for (sc = bmain->screen.first; sc; sc = sc->id.next) { - ScrArea *sa; - for (sa = sc->areabase.first; sa; sa = sa->next) { - SpaceLink *sl; - for (sl = sa->spacedata.first; sl; sl = sl->next) { - if (sl->spacetype == SPACE_IMAGE) { - SpaceImage *sima = (SpaceImage *)sl; - ED_space_image_set(sima, scene, scene->obedit, ma->texpaintslot[ma->paint_active_slot].ima); + if (ma->texpaintslot) { + Image *image = ma->texpaintslot[ma->paint_active_slot].ima; + for (sc = bmain->screen.first; sc; sc = sc->id.next) { + ScrArea *sa; + for (sa = sc->areabase.first; sa; sa = sa->next) { + SpaceLink *sl; + for (sl = sa->spacedata.first; sl; sl = sl->next) { + if (sl->spacetype == SPACE_IMAGE) { + SpaceImage *sima = (SpaceImage *)sl; + ED_space_image_set(sima, scene, scene->obedit, image); + } } } } |