aboutsummaryrefslogtreecommitdiff
path: root/dep/recastnavigation/Detour/Source/DetourCommon.cpp
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2019-03-02 19:53:46 +0100
committerjackpoz <giacomopoz@gmail.com>2019-03-02 19:53:46 +0100
commitc602220e02bed1ad76c9e60064eeec5fd97bfe80 (patch)
tree9a588f4eebd8f39bb0daa31356846fa6df505422 /dep/recastnavigation/Detour/Source/DetourCommon.cpp
parente9957b1765ceac9d8966ec50b0d64cb80e18d17a (diff)
Core/MMaps: Fix infinite loop in Detour
Fix another infinite loop in Detour caused by degenerated triangles. Check the result of some previously ignored Detour calls. Update recastnavigation to 3a619d773deb7e3a15ee215217c825995fe71312 and apply some more custom changes
Diffstat (limited to 'dep/recastnavigation/Detour/Source/DetourCommon.cpp')
-rw-r--r--dep/recastnavigation/Detour/Source/DetourCommon.cpp10
1 files changed, 9 insertions, 1 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;