[Bf-blender-cvs] [243b961c292] blender-v2.79a-release: Fix T52953: Crash removing material
Campbell Barton
noreply at git.blender.org
Mon Jan 8 17:24:00 CET 2018
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 */
More information about the Bf-blender-cvs
mailing list