diff --git a/components/detournavigator/makenavmesh.cpp b/components/detournavigator/makenavmesh.cpp index 892f9c2dd2..3f133f5033 100644 --- a/components/detournavigator/makenavmesh.cpp +++ b/components/detournavigator/makenavmesh.cpp @@ -495,6 +495,10 @@ namespace DetourNavigator params.maxPolys = 1 << polysBits; NavMeshPtr navMesh(dtAllocNavMesh(), &dtFreeNavMesh); + + if (navMesh == nullptr) + throw NavigatorException("Failed to allocate navmesh"); + const auto status = navMesh->init(¶ms); if (!dtStatusSucceed(status))