Avoid const_cast in List::erase by requiring mutable elements

This commit is contained in:
rune-scape
2024-07-28 08:01:36 -07:00
parent b00e1cbf74
commit a47daa0a44
4 changed files with 6 additions and 6 deletions

View File

@ -317,7 +317,7 @@ bool GraphEdit::is_node_connected(const StringName &p_from, int p_from_port, con
void GraphEdit::disconnect_node(const StringName &p_from, int p_from_port, const StringName &p_to, int p_to_port) {
ERR_FAIL_NULL_MSG(connections_layer, "connections_layer is missing.");
for (const List<Ref<Connection>>::Element *E = connections.front(); E; E = E->next()) {
for (List<Ref<Connection>>::Element *E = connections.front(); E; E = E->next()) {
if (E->get()->from_node == p_from && E->get()->from_port == p_from_port && E->get()->to_node == p_to && E->get()->to_port == p_to_port) {
connection_map[p_from].erase(E->get());
connection_map[p_to].erase(E->get());