summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNNesh <mullruslan@yandex.ru>2021-12-30 22:31:59 +0500
committerNNesh <mullruslan@yandex.ru>2022-01-02 00:21:36 +0500
commit0af3d6b9908323b9806e1593d116cd4d4587de83 (patch)
treef79ae2e91f3c2ac5a063c978cc1e1d47df19ff7d
parent9f058674acebf9a7a0704cdbc26dc9f6d853b16e (diff)
Fixed a invalidation of sets and out of range in the _horizontal_alignment function
Fixed start index (to the second half element) Fixed out of range when size is equal 1
-rw-r--r--scene/gui/graph_edit.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/scene/gui/graph_edit.cpp b/scene/gui/graph_edit.cpp
index a008ed7180..a37877a919 100644
--- a/scene/gui/graph_edit.cpp
+++ b/scene/gui/graph_edit.cpp
@@ -1692,7 +1692,7 @@ int GraphEdit::_set_operations(SET_OPERATIONS p_operation, Set<StringName> &r_u,
r_u.insert(E->get());
}
}
- return r_v.size();
+ return r_u.size();
} break;
default:
break;
@@ -1787,8 +1787,8 @@ void GraphEdit::_horizontal_alignment(Dictionary &r_root, Dictionary &r_align, c
}
}
- int start = up.size() / 2;
- int end = up.size() % 2 ? start : start + 1;
+ int start = (up.size() - 1) / 2;
+ int end = (up.size() - 1) % 2 ? start + 1 : start;
for (int p = start; p <= end; p++) {
StringName Align = r_align[current_node];
if (Align == current_node && r < up[p].first) {