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.
This commit is contained in:
parent
6a0ebb8088
commit
4db63b6486
Notes:
blender-bot
2023-02-14 06:00:47 +01:00
Referenced by issue #77910, Sometimes the Viewport is damaged.
|
@ -1261,7 +1261,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
|
||||
|
|
Loading…
Reference in New Issue