From da39179afd3e66caef8d0d29b67291c7d71af0dc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 2 Apr 2009 08:33:45 +0000 Subject: [#17963] NearSensor segmentation fault bugfix in bullet Caused by using the index from closestAxis4 before checking its -1 --- .../BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'extern') diff --git a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp index d4e29882d37..eecf927ee10 100644 --- a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp +++ b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp @@ -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; -- cgit v1.2.3