summaryrefslogtreecommitdiff
path: root/modules/gridmap/grid_map.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gridmap/grid_map.cpp')
-rw-r--r--modules/gridmap/grid_map.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 3c0bd56e86..db8c645558 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -557,10 +557,14 @@ bool GridMap::_octant_update(const OctantKey &p_key) {
}
//erase navigation
- for (const KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
- NavigationServer3D::get_singleton()->free(E.value.region);
+ for (KeyValue<IndexKey, Octant::NavigationCell> &E : g.navigation_cell_ids) {
+ if (E.value.region.is_valid()) {
+ NavigationServer3D::get_singleton()->free(E.value.region);
+ E.value.region = RID();
+ }
if (E.value.navigation_mesh_debug_instance.is_valid()) {
RS::get_singleton()->free(E.value.navigation_mesh_debug_instance);
+ E.value.navigation_mesh_debug_instance = RID();
}
}
g.navigation_cell_ids.clear();