[#17963] NearSensor segmentation fault

bugfix in bullet
Caused by using the index from closestAxis4 before checking its -1
This commit is contained in:
Campbell Barton 2009-04-02 08:33:45 +00:00
parent 941a8a2504
commit da39179afd

@ -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;