From 83c15ff4699d6a927a80a572d25bfb9fe8a3f60b Mon Sep 17 00:00:00 2001 From: Swarnim Arun Date: Mon, 25 May 2020 19:49:57 +0530 Subject: [PATCH] Fix crashing of VisualScript due to... Attempting to move the function node to another function whose data connection is a dependency of the node the specific node being moved to a different function during changes to sequence connections. By skipping, if the from_node is a function_node during the data connection dependencies scan. Should fix #37991 (cherry picked from commit 5c48631509751191afc5a83e4c48075a90a38150) --- modules/visual_script/visual_script_editor.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/visual_script/visual_script_editor.cpp b/modules/visual_script/visual_script_editor.cpp index ec20698ae8a..515fc5a0cf6 100644 --- a/modules/visual_script/visual_script_editor.cpp +++ b/modules/visual_script/visual_script_editor.cpp @@ -3126,6 +3126,7 @@ void VisualScriptEditor::_move_nodes_with_rescan(const StringName &p_func_from, { List data_connections; script->get_data_connection_list(p_func_from, &data_connections); + int func_from_node_id = script->get_function_node_id(p_func_from); HashMap > > connections; @@ -3135,6 +3136,11 @@ void VisualScriptEditor::_move_nodes_with_rescan(const StringName &p_func_from, int out_p = E->get().from_port; int in_p = E->get().to_port; + // skip if the from_node is a function node + if (from == func_from_node_id) { + continue; + } + if (!connections.has(to)) connections.set(to, Map >()); connections[to].insert(in_p, Pair(from, out_p));