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:
@@ -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. */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user