diff options
Diffstat (limited to 'dep/recastnavigation')
-rw-r--r-- | dep/recastnavigation/Detour/Source/DetourCommon.cpp | 10 | ||||
-rw-r--r-- | dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/dep/recastnavigation/Detour/Source/DetourCommon.cpp b/dep/recastnavigation/Detour/Source/DetourCommon.cpp index 3886f14b04d..e10e6276170 100644 --- a/dep/recastnavigation/Detour/Source/DetourCommon.cpp +++ b/dep/recastnavigation/Detour/Source/DetourCommon.cpp @@ -226,7 +226,15 @@ bool dtClosestHeightPointTriangle(const float* p, const float* a, const float* b // If point lies inside the triangle, return interpolated ycoord. if (u >= epsilon && v >= epsilon && (u+v) <= denom - epsilon) { - h = a[1] + (v0[1]*u + v1[1]*v) / denom; + + if (denom == 0.f && u == 0.f && v == 0.f) + h = a[1]; + else + h = a[1] + (v0[1]*u + v1[1]*v) / denom; + + if (!dtMathIsfinite(h)) + return false; + return true; } return false; diff --git a/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp b/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp index c18db1c1968..9e470824287 100644 --- a/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp +++ b/dep/recastnavigation/Detour/Source/DetourNavMeshQuery.cpp @@ -1301,8 +1301,8 @@ dtStatus dtNavMeshQuery::initSlicedFindPath(dtPolyRef startRef, dtPolyRef endRef m_query.raycastLimitSqr = FLT_MAX; // Validate input - if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) - || !startPos || !dtVisfinite(startPos) || + if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) || + !startPos || !dtVisfinite(startPos) || !endPos || !dtVisfinite(endPos) || !filter) { return DT_FAILURE | DT_INVALID_PARAM; |