diff options
author | Bastien Montagne <bastien@blender.org> | 2022-04-12 19:16:46 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2022-04-12 19:43:26 +0300 |
commit | a0957ceab2635676b057b69d0a241fe895005466 (patch) | |
tree | bcb52d8042a2dc2fe133a61d53835ae9906c2884 /source/blender/blenkernel/intern/layer.c | |
parent | 48014fbf1432de2ad74ef76280673062d9870af7 (diff) |
Fix T97069: Null collection object during layercollection resync when relinking.
We better handle NULL object pointers before doing layer collections
resync, otherwise said resync process has to deal with those NULL
pointers. By the look of it this mistake has been there since the origin
of the remapping/relinking code.
Also for safety (and optimization), do not perform layer collection
resync from `libblock_remap_data_postprocess_object_update` when
`libblock_remap_data_postprocess_collection_update` is called
immediately afterwards.
Also added same 'skip on NULL collection object pointer' check to
`layer_collection_local_sync` as the one in
`layer_collection_objects_sync`, since it's fairly hard to always
guaranty there is no such NULL pointer when calling that code.
Diffstat (limited to 'source/blender/blenkernel/intern/layer.c')
-rw-r--r-- | source/blender/blenkernel/intern/layer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 1cc1839d2d0..f0ccd305690 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1658,7 +1658,10 @@ static void layer_collection_local_sync(ViewLayer *view_layer, if (visible) { LISTBASE_FOREACH (CollectionObject *, cob, &layer_collection->collection->gobject) { - BLI_assert(cob->ob); + if (cob->ob == NULL) { + continue; + } + Base *base = BKE_view_layer_base_find(view_layer, cob->ob); base->local_collections_bits |= local_collections_uuid; } |