summaryrefslogtreecommitdiffstats
path: root/modules/navigation/godot_navigation_server.cpp
diff options
context:
space:
mode:
authorPawel Lampe <pawel.lampe@gmail.com>2023-06-19 23:41:24 +0200
committerPawel Lampe <pawel.lampe@gmail.com>2023-06-20 17:48:06 +0200
commite1bdde911c21c76e866f16e4208d517438e44d2e (patch)
treec0f2490e4913907b4f0d846a4cb87def10a08655 /modules/navigation/godot_navigation_server.cpp
parent7b170d12cf0f8b3a15572fd203aa5cba840975f3 (diff)
downloadredot-engine-e1bdde911c21c76e866f16e4208d517438e44d2e.tar.gz
Add `agent` and `map` tests for 'NavigationServer3D'
This commits fixes a bug in `free()` function as well.
Diffstat (limited to 'modules/navigation/godot_navigation_server.cpp')
-rw-r--r--modules/navigation/godot_navigation_server.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/navigation/godot_navigation_server.cpp b/modules/navigation/godot_navigation_server.cpp
index cfd0cc6d46..d43a069dd4 100644
--- a/modules/navigation/godot_navigation_server.cpp
+++ b/modules/navigation/godot_navigation_server.cpp
@@ -997,8 +997,10 @@ COMMAND_1(free, RID, p_object) {
}
int map_index = active_maps.find(map);
- active_maps.remove_at(map_index);
- active_maps_update_id.remove_at(map_index);
+ if (map_index >= 0) {
+ active_maps.remove_at(map_index);
+ active_maps_update_id.remove_at(map_index);
+ }
map_owner.free(p_object);
} else if (region_owner.owns(p_object)) {