Merge pull request #39041 from swarnimarun/patch-1

Fix crashing of VisualScript due to function change
This commit is contained in:
Rémi Verschelde 2020-06-04 11:55:12 +02:00 committed by GitHub
commit 6a7b55805b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -3216,6 +3216,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;
@ -3225,6 +3226,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>>());
} }