diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index b83bff5d5e8..f910112a765 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -606,7 +606,7 @@ - Removes a node from a group. See notes in the description, and the group methods in [SceneTree]. + Removes a node from the [param group]. Does nothing if the node is not in the [param group]. See notes in the description, and the group methods in [SceneTree]. diff --git a/scene/main/node.cpp b/scene/main/node.cpp index 473f69a1727..377620af642 100644 --- a/scene/main/node.cpp +++ b/scene/main/node.cpp @@ -1759,11 +1759,11 @@ void Node::add_to_group(const StringName &p_identifier, bool p_persistent) { } void Node::remove_from_group(const StringName &p_identifier) { - ERR_FAIL_COND(!data.grouped.has(p_identifier)); - HashMap::Iterator E = data.grouped.find(p_identifier); - ERR_FAIL_COND(!E); + if (!E) { + return; + } if (data.tree) { data.tree->remove_from_group(E->key, this);