Bugfix: Fix crashes with empty material slots
authorJoshua Leung <aligorith@gmail.com>
Tue, 3 Jul 2012 05:46:44 +0000 (05:46 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 3 Jul 2012 05:46:44 +0000 (05:46 +0000)
source/blender/blenkernel/intern/depsgraph.c
source/blender/blenkernel/intern/object.c

index 65d36d665dbebd13c17ffa92d4cb3cb12f3fc5a7..79beb900306a73f558233b1b5bc34d52e6359e7f 100644 (file)
@@ -622,8 +622,10 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
                for (a = 1; a <= ob->totcol; a++) {
                        Material *ma = give_current_material(ob, a);
                        
-                       /* recursively figure out if there are drivers, and hook these up to this object */
-                       dag_add_material_driver_relations(dag, node, ma);
+                       if (ma) {
+                               /* recursively figure out if there are drivers, and hook these up to this object */
+                               dag_add_material_driver_relations(dag, node, ma);
+                       }
                }
        }
        
index 74f3d3ddb9da59c26ca7165126e5e0d4cf3868ae..b182a7308ac2edc0d32e310e3eb6080434bf407f 100644 (file)
@@ -2607,8 +2607,10 @@ void BKE_object_handle_update(Scene *scene, Object *ob)
                                for (a = 1; a <= ob->totcol; a++) {
                                        Material *ma = give_current_material(ob, a);
                                        
-                                       /* recursively update drivers for this material */
-                                       material_drivers_update(scene, ma, ctime);
+                                       if (ma) {
+                                               /* recursively update drivers for this material */
+                                               material_drivers_update(scene, ma, ctime);
+                                       }
                                }
                        }