node: fixed catastrophic array bug

Jesus Christ how did this not get caught sooner
This commit is contained in:
itsmattkc
2022-01-23 14:51:04 -08:00
parent 8f8d43f634
commit b1ae7d5eda
+2 -2
View File
@@ -755,7 +755,7 @@ void Node::InputArrayInsert(const QString &id, int index, bool undoable)
// Move connections down
InputConnections copied_edges = input_connections();
for (auto it=copied_edges.crbegin(); it!=copied_edges.crend(); it++) {
if (it->first.element() >= index) {
if (it->first.input() == id && it->first.element() >= index) {
// Disconnect this and reconnect it one element down
NodeInput new_edge = it->first;
new_edge.set_element(new_edge.element() + 1);
@@ -802,7 +802,7 @@ void Node::InputArrayRemove(const QString &id, int index, bool undoable)
// Move connections up
InputConnections copied_edges = input_connections();
for (auto it=copied_edges.cbegin(); it!=copied_edges.cend(); it++) {
if (it->first.element() >= index) {
if (it->first.input() == id && it->first.element() >= index) {
// Disconnect this and reconnect it one element up if it's not the element being removed
DisconnectEdge(it->second, it->first);