Bugfix: Fix crashes with empty material slots

This commit is contained in:
Joshua Leung 2012-07-03 05:46:44 +00:00
parent d58cb1beaa
commit 6a2a424c40
2 changed files with 8 additions and 4 deletions

@ -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);
}
}
}

@ -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);
}
}
}