Fix T81168: 2.8x Crash when loading 2.79 file.

Object in the 2.7x file is on no layer at all, while this is not really
expected nor considered valid, better to cope with the case gracefully
than crash.

To be backported to 2.90 and 2.83.
This commit is contained in:
Bastien Montagne 2020-09-26 09:21:27 +02:00 committed by Jeroen Bakker
parent 7ac5695b29
commit b72df3a4a4
Notes: blender-bot 2023-02-13 22:19:26 +01:00
Referenced by issue #81168, 2.8x Crash when loading 2.79 file
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 6 additions and 1 deletions

View File

@ -1241,7 +1241,12 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
break;
}
}
BLI_assert(collection_hidden != NULL);
if (collection_hidden == NULL) {
/* This should never happen (objects are always supposed to be instantiated in a
* scene), but it does sometimes, see e.g. T81168.
* Just put them in first hidden collection in those cases. */
collection_hidden = &hidden_collection_array[0];
}
if (*collection_hidden == NULL) {
char name[MAX_ID_NAME];