Fix GridMap free navigation RID error spam

Fixes GridMap free navigation RID error spam.
This commit is contained in:
smix8 2023-03-14 05:12:39 +01:00 committed by Relintai
parent a76df86ef3
commit 6eb9ac3085

View File

@ -476,7 +476,10 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
//erase navigation //erase navigation
for (RBMap<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) { for (RBMap<IndexKey, Octant::NavMesh>::Element *E = g.navmesh_ids.front(); E; E = E->next()) {
NavigationServer::get_singleton()->free(E->get().region); if (E->get().region.is_valid()) {
NavigationServer::get_singleton()->free(E->get().region);
E->get().region = RID();
}
if (E->get().navmesh_debug_instance.is_valid()) { if (E->get().navmesh_debug_instance.is_valid()) {
RS::get_singleton()->free(E->get().navmesh_debug_instance); RS::get_singleton()->free(E->get().navmesh_debug_instance);
} }