From 793c30ab8daa80658c55c54a42fd9b5cd57b704a Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 30 Jun 2021 20:06:45 +0200 Subject: [PATCH] Check dtNavMeshQuery::getPolyHeight status Otherwise when it fails a node with zero height will be added to a path. --- components/detournavigator/findsmoothpath.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/detournavigator/findsmoothpath.hpp b/components/detournavigator/findsmoothpath.hpp index 8baa8206c6..4e656e6270 100644 --- a/components/detournavigator/findsmoothpath.hpp +++ b/components/detournavigator/findsmoothpath.hpp @@ -241,7 +241,8 @@ namespace DetourNavigator } } - navMeshQuery.getPolyHeight(polygonPath.front(), result->mResultPos.ptr(), &iterPos.y()); + if (dtStatusFailed(navMeshQuery.getPolyHeight(polygonPath.front(), result->mResultPos.ptr(), &iterPos.y()))) + return Status::GetPolyHeightFailed; iterPos.x() = result->mResultPos.x(); iterPos.z() = result->mResultPos.z();