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.
This commit is contained in:
Hein-Pieter van Braam 2018-03-02 09:37:32 +01:00
parent 08cadc3d87
commit 555eebf3f4
1 changed files with 1 additions and 0 deletions

View File

@ -35,6 +35,7 @@ void Navigation::_navmesh_link(int p_id) {
ERR_FAIL_COND(!navmesh_map.has(p_id)); ERR_FAIL_COND(!navmesh_map.has(p_id));
NavMesh &nm = navmesh_map[p_id]; NavMesh &nm = navmesh_map[p_id];
ERR_FAIL_COND(nm.linked); ERR_FAIL_COND(nm.linked);
ERR_FAIL_COND(nm.navmesh.is_null());
PoolVector<Vector3> vertices = nm.navmesh->get_vertices(); PoolVector<Vector3> vertices = nm.navmesh->get_vertices();
int len = vertices.size(); int len = vertices.size();