[#17963] NearSensor segmentation fault
authorCampbell Barton <ideasman42@gmail.com>
Thu, 2 Apr 2009 08:33:45 +0000 (08:33 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 2 Apr 2009 08:33:45 +0000 (08:33 +0000)
bugfix in bullet
Caused by using the index from closestAxis4 before checking its -1

extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp

index d4e29882d376d2c59bfca3fc0d3494426d88068e..eecf927ee1051bfaef29674968531028b29a5e7d 100644 (file)
@@ -172,6 +172,9 @@ int btPersistentManifold::addManifoldPoint(const btManifoldPoint& newPoint)
 #if MANIFOLD_CACHE_SIZE >= 4
                //sort cache so best points come first, based on area
                insertIndex = sortCachedPoints(newPoint);
+               
+               if (insertIndex<0)
+                       insertIndex=0;
 #else
                insertIndex = 0;
 #endif
@@ -180,11 +183,7 @@ int btPersistentManifold::addManifoldPoint(const btManifoldPoint& newPoint)
        } else
        {
                m_cachedPoints++;
-
-               
        }
-       if (insertIndex<0)
-               insertIndex=0;
 
        btAssert(m_pointCache[insertIndex].m_userPersistentData==0);
        m_pointCache[insertIndex] = newPoint;