From 555eebf3f4845c8138c24ded96fcb3fa5c67787a Mon Sep 17 00:00:00 2001 From: Hein-Pieter van Braam Date: Fri, 2 Mar 2018 09:37:32 +0100 Subject: [PATCH] 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. --- scene/3d/navigation.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/3d/navigation.cpp b/scene/3d/navigation.cpp index e7ab6cde8a..77bf703706 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 vertices = nm.navmesh->get_vertices(); int len = vertices.size();