aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHein-Pieter van Braam2018-03-02 09:37:32 +0100
committerHein-Pieter van Braam2018-03-02 12:06:46 +0100
commitcee20e24bda772ddf5daad1e42ba689f4eb94366 (patch)
tree5cfe5de2416a327881c69d54be51e4a0d70feb84
parent87476c057a60f3ab6fc16ee1824d6b98990016a0 (diff)
downloadgodot-cee20e24bda772ddf5daad1e42ba689f4eb94366.tar.gz
godot-cee20e24bda772ddf5daad1e42ba689f4eb94366.tar.zst
godot-cee20e24bda772ddf5daad1e42ba689f4eb94366.zip
Don't crash when trying to add an invalid navmesh
It is possible to try to add an invalid object as a navmesh through GDScript which results in an engine crash. This creates a debug message that should help the user figure out what's wrong. (cherry picked from commit 555eebf3f4845c8138c24ded96fcb3fa5c67787a)
-rw-r--r--scene/3d/navigation.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp
index e7ab6cde8..77bf70370 100644
--- a/scene/3d/navigation.cpp
+++ b/scene/3d/navigation.cpp
@@ -35,6 +35,7 @@ void Navigation::_navmesh_link(int p_id) {
ERR_FAIL_COND(!navmesh_map.has(p_id));
NavMesh &nm = navmesh_map[p_id];
ERR_FAIL_COND(nm.linked);
+ ERR_FAIL_COND(nm.navmesh.is_null());
PoolVector<Vector3> vertices = nm.navmesh->get_vertices();
int len = vertices.size();