diff options
| author | Hein-Pieter van Braam | 2018-03-02 09:37:32 +0100 |
|---|---|---|
| committer | Hein-Pieter van Braam | 2018-03-02 12:06:46 +0100 |
| commit | cee20e24bda772ddf5daad1e42ba689f4eb94366 (patch) | |
| tree | 5cfe5de2416a327881c69d54be51e4a0d70feb84 | |
| parent | 87476c057a60f3ab6fc16ee1824d6b98990016a0 (diff) | |
| download | godot-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.cpp | 1 |
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(); |
