diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 86326655cfe..0cf2993133c 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -1124,6 +1124,12 @@ void BKE_object_copy_data(Main *UNUSED(bmain), Object *ob_dst, const Object *ob_ ob_dst->matbits = MEM_dupallocN(ob_src->matbits); ob_dst->totcol = ob_src->totcol; } + else if (ob_dst->mat != NULL || ob_dst->matbits != NULL) { + /* This shall not be needed, but better be safe than sorry. */ + BLI_assert(!"Object copy: non-NULL material pointers with zero counter, should not happen."); + ob_dst->mat = NULL; + ob_dst->matbits = NULL; + } if (ob_src->iuser) ob_dst->iuser = MEM_dupallocN(ob_src->iuser);