Commit: 243b961c2923cad3dc84616666285c4134139676 Author: Campbell Barton Date: Thu Jan 4 21:35:09 2018 +1100 Branches: blender-v2.79a-release https://developer.blender.org/rB243b961c2923cad3dc84616666285c4134139676
Fix T52953: Crash removing material =================================================================== M source/blender/blenkernel/intern/material.c =================================================================== diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index f21efb71180..c88a5448e2d 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1179,7 +1179,6 @@ void material_drivers_update(Scene *scene, Material *ma, float ctime) bool BKE_object_material_slot_remove(Object *ob) { Material *mao, ***matarar; - Object *obt; short *totcolp; short a, actcol; @@ -1227,11 +1226,13 @@ bool BKE_object_material_slot_remove(Object *ob) } actcol = ob->actcol; - obt = G.main->object.first; - while (obt) { - + + for (Object *obt = G.main->object.first; obt; obt = obt->id.next) { if (obt->data == ob->data) { - + /* Can happen when object material lists are used, see: T52953 */ + if (actcol > obt->totcol) { + continue; + } /* WATCH IT: do not use actcol from ob or from obt (can become zero) */ mao = obt->mat[actcol - 1]; if (mao) @@ -1251,7 +1252,6 @@ bool BKE_object_material_slot_remove(Object *ob) obt->matbits = NULL; } } - obt = obt->id.next; } /* check indices from mesh */ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs