[Bf-blender-cvs] [4db63b64864] master: Fix crash when opening some old/broken .blend files after recent fix.

Bastien Montagne noreply at git.blender.org
Mon Jun 15 18:49:51 CEST 2020


Commit: 4db63b64864390a07851e74388527320feebeafb
Author: Bastien Montagne
Date:   Mon Jun 15 18:48:25 2020 +0200
Branches: master
https://developer.blender.org/rB4db63b64864390a07851e74388527320feebeafb

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.

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

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

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

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index 1928a6da0fa..ec9d3cac5a1 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -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



More information about the Bf-blender-cvs mailing list