[Bf-blender-cvs] [cf38c4d49f0] temp-lanpr-review: Fix NULL-ptr mem-copy

Julian Eisel noreply at git.blender.org
Wed Nov 27 16:03:26 CET 2019


Commit: cf38c4d49f0e15e207459dde5a3aa27e0eb6a34a
Author: Julian Eisel
Date:   Wed Nov 27 16:03:00 2019 +0100
Branches: temp-lanpr-review
https://developer.blender.org/rBcf38c4d49f0e15e207459dde5a3aa27e0eb6a34a

Fix NULL-ptr mem-copy

===================================================================

M	source/blender/blenkernel/intern/collection.c

===================================================================

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 44fb108bac7..ec8e8bb1b3f 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -239,7 +239,9 @@ void BKE_collection_copy_data(Main *bmain,
     CollectionLANPR *lanpr = MEM_callocN(sizeof(CollectionLANPR), "Duplicated CollectionLANPR");
     collection_dst->lanpr = lanpr;
   }
-  memcpy(collection_dst->lanpr, collection_src->lanpr, sizeof(CollectionLANPR));
+  if (collection_dst->lanpr != NULL) {
+    memcpy(collection_dst->lanpr, collection_src->lanpr, sizeof(CollectionLANPR));
+  }
 }
 
 static Collection *collection_duplicate_recursive(Main *bmain,



More information about the Bf-blender-cvs mailing list