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 5c48631509)
This commit is contained in:
Swarnim Arun 2020-05-25 19:49:57 +05:30 committed by Rémi Verschelde
parent b0fe8cab14
commit 83c15ff469

View File

@ -3126,6 +3126,7 @@ void VisualScriptEditor::_move_nodes_with_rescan(const StringName &p_func_from,
{ {
List<VisualScript::DataConnection> data_connections; List<VisualScript::DataConnection> data_connections;
script->get_data_connection_list(p_func_from, &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<int, Map<int, Pair<int, int> > > connections; HashMap<int, Map<int, Pair<int, int> > > connections;
@ -3135,6 +3136,11 @@ void VisualScriptEditor::_move_nodes_with_rescan(const StringName &p_func_from,
int out_p = E->get().from_port; int out_p = E->get().from_port;
int in_p = E->get().to_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)) if (!connections.has(to))
connections.set(to, Map<int, Pair<int, int> >()); connections.set(to, Map<int, Pair<int, int> >());
connections[to].insert(in_p, Pair<int, int>(from, out_p)); connections[to].insert(in_p, Pair<int, int>(from, out_p));