diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-01-04 13:35:09 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-01-04 13:35:09 +0300 |
commit | 0becc8a7dd6d527f05363434cd177936220e6da1 (patch) | |
tree | 17449e7a5717cbc01892eeff633acd6e5176e58e /source/blender/blenkernel/intern/material.c | |
parent | 457dc8d12ca79247349aa3e76457a9f45e73026e (diff) |
Fix T52953: Crash removing material
Diffstat (limited to 'source/blender/blenkernel/intern/material.c')
-rw-r--r-- | source/blender/blenkernel/intern/material.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c index 147b169910e..07c2ff4ba9d 100644 --- a/source/blender/blenkernel/intern/material.c +++ b/source/blender/blenkernel/intern/material.c @@ -1207,7 +1207,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; @@ -1255,11 +1254,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) @@ -1279,7 +1280,6 @@ bool BKE_object_material_slot_remove(Object *ob) obt->matbits = NULL; } } - obt = obt->id.next; } /* check indices from mesh */ |