From 2c9ba55c7fbe1c2b33022c2ccb033cf777898a9a Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 17 Mar 2023 13:55:01 +0100 Subject: [PATCH] Fix #105849: crash when using link-swap with an existing link The code didn't check if there was actually a link to displace. --- source/blender/editors/space_node/node_relationships.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/space_node/node_relationships.cc b/source/blender/editors/space_node/node_relationships.cc index 6b8c6df9ca5..3b109d8b1e2 100644 --- a/source/blender/editors/space_node/node_relationships.cc +++ b/source/blender/editors/space_node/node_relationships.cc @@ -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);