From 365271a5886e1678b41e636581616446766b5f85 Mon Sep 17 00:00:00 2001 From: Nathan Craddock Date: Wed, 16 Sep 2020 09:03:37 -0600 Subject: 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. --- source/blender/blenkernel/intern/collection.c | 1 + source/blender/blenloader/intern/versioning_290.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender') 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; + } } } -- cgit v1.2.3