[3.5+] Fix GridMap free navigation RID error spam

Fixes GridMap free navigation RID error spam.

(cherry picked from commit befdafdbf6)
This commit is contained in:
smix8 2023-03-14 05:12:39 +01:00 committed by Rémi Verschelde
parent 2e8e7b8b79
commit d89af40a7a
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -473,7 +473,10 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
//erase navigation
for (Map<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()) {
VS::get_singleton()->free(E->get().navmesh_debug_instance);
}