Fix T81272: Crash on opening old files where nodetrees had no name.

This code gets called before do_version can fix that, so we have to work
around it for now.
This commit is contained in:
2020-10-07 10:06:21 +02:00
parent 084d911010
commit 5b97e50976

View File

@@ -489,6 +489,11 @@ void BKE_idtype_id_foreach_cache(struct ID *id,
bNodeTree *nodetree = ntreeFromID(id);
if (nodetree != NULL) {
type_info = BKE_idtype_get_info_from_id(&nodetree->id);
if (type_info == NULL) {
/* Very old .blend file seem to have empty names for their embedded node trees, see
* `blo_do_versions_250()`. Assume those are nodetrees then. */
type_info = BKE_idtype_get_info_from_idcode(ID_NT);
}
if (type_info->foreach_cache != NULL) {
type_info->foreach_cache(&nodetree->id, function_callback, user_data);
}