From a52fdba793b7b7cd85f4d6bcb282f444b1f1a61b Mon Sep 17 00:00:00 2001
From: panjia1983 <panjia1983@gmail.com>
Date: Thu, 27 Dec 2012 03:49:13 -0500
Subject: [PATCH] Update src/intersect.cpp

fix the crash caused by the typo in intersect_Triangle
---
 src/intersect.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/intersect.cpp b/src/intersect.cpp
index a862201a..efce14ba 100644
--- a/src/intersect.cpp
+++ b/src/intersect.cpp
@@ -900,7 +900,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f
     if(penetration_depth1 > penetration_depth2)
     {
       *num_contact_points = std::min(num_deepest_points2, (unsigned int)2);
-      for(unsigned int i = 0; i < num_deepest_points2; ++i)
+      for(unsigned int i = 0; i < *num_contact_points; ++i)
       {
         contact_points[i] = deepest_points2[i];
       }
@@ -911,7 +911,7 @@ bool Intersect::intersect_Triangle(const Vec3f& P1, const Vec3f& P2, const Vec3f
     else
     {
       *num_contact_points = std::min(num_deepest_points1, (unsigned int)2);
-      for(unsigned int i = 0; i < num_deepest_points1; ++i)
+      for(unsigned int i = 0; i < *num_contact_points; ++i)
       {
         contact_points[i] = deepest_points1[i];
       }
-- 
GitLab