diff options
author | Jacques Lucke <jacques@blender.org> | 2022-11-11 13:48:56 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-11-11 13:48:56 +0300 |
commit | 57dd1b7799e7453e34c3a503333d0eadfa87af17 (patch) | |
tree | adce5313453c5c3aafdf687dd31862bb0d888bf5 /source/blender/makesrna/intern/rna_nodetree.c | |
parent | 84c66fe9db932b82ebf445a63dfb629fb3c1b35c (diff) |
Fix T102386: crash when trying to link sockets from different node trees
This was caused by rBc39eb09ae587e1d9. The optimization broke the case
when the socket is not in the provided node tree. Now there are two separate
functions, one that always does the slow check to see of the socket is really
in the node tree and a potentially much faster version when we are sure
that the socket is in the tree.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 14122ddb878..c6115711c1a 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1302,8 +1302,8 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, return NULL; } - nodeFindNode(ntree, fromsock, &fromnode, NULL); - nodeFindNode(ntree, tosock, &tonode, NULL); + nodeFindNodeTry(ntree, fromsock, &fromnode, NULL); + nodeFindNodeTry(ntree, tosock, &tonode, NULL); /* check validity of the sockets: * if sockets from different trees are passed in this will fail! */ @@ -2789,9 +2789,7 @@ static char *rna_NodeSocket_path(const PointerRNA *ptr) int socketindex; char name_esc[sizeof(node->name) * 2]; - if (!nodeFindNode(ntree, sock, &node, &socketindex)) { - return NULL; - } + nodeFindNode(ntree, sock, &node, &socketindex); BLI_str_escape(name_esc, node->name, sizeof(name_esc)); |