Fix #105849: crash when using link-swap with an existing link

The code didn't check if there was actually a link to displace.
This commit is contained in:
Jacques Lucke
2023-03-17 13:55:01 +01:00
parent 6d3ce8273a
commit 2c9ba55c7f

View File

@@ -900,7 +900,11 @@ static void displace_links(bNodeTree *ntree, const bNode *node, bNodeLink *inser
if (linked_socket->is_input()) {
BLI_assert(!linked_socket->is_multi_input());
ntree->ensure_topology_cache();
bNodeLink *displaced_link = linked_socket->runtime->directly_linked_links.first();
if (linked_socket->directly_linked_links().is_empty()) {
return;
}
bNodeLink *displaced_link = linked_socket->directly_linked_links().first();
if (!replacement_socket) {
nodeRemLink(ntree, displaced_link);