Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-08-14 14:35:51 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-08-14 15:06:42 +0300
commit932251caea88b87bd65dd5c453dd3133457ffb1b (patch)
tree386c75ffdfc1168ebc970692195ba50229ec8629 /source
parent73234a9122666035592a8733f0df73beaf2e2a2d (diff)
Fix object copying not ensuring validity of material arrays.
Related to T56363, this is not fixing the root of the bug, but ID copying should always be a good occasion to ensure sanity of our data (and error checking is always better than a crash!).
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/object.c6
1 files changed, 6 insertions, 0 deletions
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);