Fix #124463: crash when trying link a node to itself with swapping

The swapping code incorrectly expected the link to have a start and end.
However, this was not necessarily the case when attempting to create
a link from a node to itself. This case has special handling in
`node_link_find_socket`.
This commit is contained in:
Jacques Lucke
2024-07-11 15:00:02 +02:00
parent b9e15791f9
commit 1d4ef04a6d
2 changed files with 4 additions and 0 deletions

View File

@@ -46,6 +46,7 @@ struct NestedTreePreviews;
struct bNodeLinkDrag {
/** Links dragged by the operator. */
Vector<bNodeLink> links;
/** Which side if the links is fixed. */
eNodeSocketInOut in_out;
/** Draw handler for the tooltip icon when dragging a link in empty space. */

View File

@@ -1087,6 +1087,9 @@ static void displace_links(bNodeTree *ntree, const bNode *node, bNodeLink *inser
static void node_displace_existing_links(bNodeLinkDrag &nldrag, bNodeTree &ntree)
{
bNodeLink &link = nldrag.links.first();
if (!link.fromsock || !link.tosock) {
return;
}
if (nldrag.start_socket->is_input()) {
displace_links(&ntree, link.fromnode, &link);
}