[Bf-blender-cvs] [5b97e50976b] master: Fix T81272: Crash on opening old files where nodetrees had no name.
Bastien Montagne
noreply at git.blender.org
Wed Oct 7 10:18:50 CEST 2020
Commit: 5b97e50976b0b4c54b725dc6a85c9736904bccdb
Author: Bastien Montagne
Date: Wed Oct 7 10:06:21 2020 +0200
Branches: master
https://developer.blender.org/rB5b97e50976b0b4c54b725dc6a85c9736904bccdb
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.
===================================================================
M source/blender/blenkernel/intern/idtype.c
===================================================================
diff --git a/source/blender/blenkernel/intern/idtype.c b/source/blender/blenkernel/intern/idtype.c
index 6ef3817bc1c..44bf8f0e4db 100644
--- a/source/blender/blenkernel/intern/idtype.c
+++ b/source/blender/blenkernel/intern/idtype.c
@@ -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);
}
More information about the Bf-blender-cvs
mailing list