From 57dd1b7799e7453e34c3a503333d0eadfa87af17 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 11 Nov 2022 11:48:56 +0100 Subject: 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. --- source/blender/makesrna/intern/rna_nodetree.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source/blender/makesrna/intern/rna_nodetree.c') 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)); -- cgit v1.2.3