diff options
author | Bastien Montagne <bastien@blender.org> | 2020-06-15 19:48:25 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-06-30 13:49:11 +0300 |
commit | 91713421859100d152b626ec28fede16d306ea29 (patch) | |
tree | 6f0d2667bf00e6b726692a13810cdbc51d1677d5 /source/blender/blenkernel | |
parent | b894480d68b2589115e62434aeb86f05b73b2414 (diff) |
Fix crash when opening some old/broken .blend files after recent fix.
Now that `BKE_main_collections_parent_relations_rebuild()` is called
from readfile code, we need to make it resilient to potential NULL
master collection pointer in scenes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 583bb39a851..eda2c6b01da 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -1138,7 +1138,11 @@ void BKE_main_collections_parent_relations_rebuild(Main *bmain) /* Scene's master collections will be 'root' parent of most of our collections, so start with * them. */ for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { - collection_parents_rebuild_recursive(scene->master_collection); + /* This function can be called from readfile.c, when this pointer is not guaranteed to be NULL. + */ + if (scene->master_collection != NULL) { + collection_parents_rebuild_recursive(scene->master_collection); + } } /* We may have parent chains outside of scene's master_collection context? At least, readfile's |