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:
Bastien Montagne 2020-10-07 10:06:21 +02:00
parent 084d911010
commit 5b97e50976
Notes: blender-bot 2023-02-13 21:18:00 +01:00
Referenced by issue #81272, Blender 2.90.1 silently exits on opening older .blend file, although open in 2.79b + save and open that new one in 2.90.1 succeeds
Referenced by issue #80396, Potential candidates for corrective releases
1 changed files with 5 additions and 0 deletions

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);
}