[Bf-blender-cvs] [365271a5886] master: Fix tests after adding collection color tagging

Nathan Craddock noreply at git.blender.org
Wed Sep 16 17:07:46 CEST 2020


Commit: 365271a5886e1678b41e636581616446766b5f85
Author: Nathan Craddock
Date:   Wed Sep 16 09:03:37 2020 -0600
Branches: master
https://developer.blender.org/rB365271a5886e1678b41e636581616446766b5f85

Fix tests after adding collection color tagging

Fix a segfault caused by assuming all scenes have a master collection
when applying versioning to old files.

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

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

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

diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c
index e8b29ffac3e..de2ec273567 100644
--- a/source/blender/blenkernel/intern/collection.c
+++ b/source/blender/blenkernel/intern/collection.c
@@ -650,6 +650,7 @@ Collection *BKE_collection_master_add()
   STRNCPY(master_collection->id.name, "GRMaster Collection");
   master_collection->id.flag |= LIB_EMBEDDED_DATA;
   master_collection->flag |= COLLECTION_IS_MASTER;
+  master_collection->color_tag = COLLECTION_COLOR_NONE;
   return master_collection;
 }
 
diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c
index 8a5f77fac1d..064b6139fde 100644
--- a/source/blender/blenloader/intern/versioning_290.c
+++ b/source/blender/blenloader/intern/versioning_290.c
@@ -658,7 +658,11 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain)
       collection->color_tag = COLLECTION_COLOR_NONE;
     }
     LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
-      scene->master_collection->color_tag = COLLECTION_COLOR_NONE;
+      /* Old files do not have a master collection, but it will be created by
+       * `BKE_collection_master_add()`. */
+      if (scene->master_collection) {
+        scene->master_collection->color_tag = COLLECTION_COLOR_NONE;
+      }
     }
   }



More information about the Bf-blender-cvs mailing list