Commit: d1c91016429e81aa96f4ff64da773deec8f060ee
Author: Antony Riakiotakis
Date:   Thu Aug 28 21:30:29 2014 +0200
Branches: master
https://developer.blender.org/rBd1c91016429e81aa96f4ff64da773deec8f060ee

Fix some crash cases after last commit

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

M       source/blender/blenkernel/intern/material.c
M       source/blender/editors/sculpt_paint/paint_image.c

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

diff --git a/source/blender/blenkernel/intern/material.c 
b/source/blender/blenkernel/intern/material.c
index e750039..8ccdb8a 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -1340,8 +1340,11 @@ void BKE_texpaint_slot_refresh_cache(Scene *scene, 
Material *ma)
        if (use_nodes || ma->use_nodes) {
                bNode *node, *active_node;
 
-               if (!(ma->nodetree))
+               if (!(ma->nodetree)) {
+                       ma->paint_active_slot = 0;
+                       ma->paint_clone_slot = 0;
                        return;
+               }
 
                for (node = ma->nodetree->nodes.first; node; node = node->next) 
{
                        if (node->typeinfo->nclass == NODE_CLASS_TEXTURE && 
node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id)
diff --git a/source/blender/editors/sculpt_paint/paint_image.c 
b/source/blender/editors/sculpt_paint/paint_image.c
index f596f33..f0176bc 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -1391,20 +1391,21 @@ void paint_proj_mesh_data_ensure(bContext *C, Object 
*ob, wmOperator *op)
                                                if (!ma->texpaintslot) {
                                                        proj_paint_add_slot(C, 
ma, NULL);
                                                        
-                                                       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[0].ima);
+                                                       if (ma->texpaintslot) {
+                                                               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[0].ima);
+                                                                               
        }
                                                                                
}
                                                                        }
                                                                }
-                                                       }
-                                                       
+                                                       }                       
                                
                                                }
                                        }
                                }

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to