Commit: 64e955f52228b573aeffb96d0b74db8eb6931190
Author: Campbell Barton
Date:   Wed Sep 10 21:56:45 2014 +1000
Branches: master
https://developer.blender.org/rB64e955f52228b573aeffb96d0b74db8eb6931190

Fix crash in active_paint_texture_index callback

===================================================================

M       source/blender/makesrna/intern/rna_material.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_material.c 
b/source/blender/makesrna/intern/rna_material.c
index 37b6947..2e0ad63 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);
+                                       }
                                }
                        }
                }

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to