Fix T86298: crash when loading "corrupted" geometry node tree

The file was not really corrupted (as in, Blender did everything
correctly while saving). I only did not consider the case when
a .blend file is resaved in an older version before.
This commit is contained in:
Jacques Lucke 2021-03-29 16:56:53 +02:00
parent bc872e0c8e
commit 81fae56cb9
Notes: blender-bot 2023-02-14 06:54:28 +01:00
Referenced by issue #86298, Crashin during opening saved scene in 2.92.0 or 2.9.3
1 changed files with 7 additions and 0 deletions

View File

@ -778,6 +778,13 @@ static void lib_link_node_socket(BlendLibReader *reader, Library *lib, bNodeSock
{
IDP_BlendReadLib(reader, sock->prop);
/* This can happen for all socket types when a file is saved in an older version of Blender than
* it was originally created in (T86298). Some socket types still require a default value. The
* default value of those sockets will be created in `ntreeSetTypes`. */
if (sock->default_value == nullptr) {
return;
}
switch ((eNodeSocketDatatype)sock->type) {
case SOCK_OBJECT: {
bNodeSocketValueObject *default_value = (bNodeSocketValueObject *)sock->default_value;