Fix possible bullet crash

This commit is contained in:
Benau 2020-03-09 16:12:49 +08:00
parent 1ea75b5f0e
commit 10e7ac603f
2 changed files with 8 additions and 6 deletions

View File

@ -176,16 +176,16 @@ int btPersistentManifold::addManifoldPoint(const btManifoldPoint& newPoint)
#else
insertIndex = 0;
#endif
if (insertIndex < 0 || insertIndex >= MANIFOLD_CACHE_SIZE)
insertIndex = 0;
clearUserCache(m_pointCache[insertIndex]);
} else
}
else
{
m_cachedPoints++;
if (insertIndex < 0 || insertIndex >= MANIFOLD_CACHE_SIZE)
insertIndex = 0;
}
if (insertIndex<0)
insertIndex=0;
btAssert(m_pointCache[insertIndex].m_userPersistentData==0);
m_pointCache[insertIndex] = newPoint;

View File

@ -422,6 +422,8 @@ void btPolyhedralContactClipping::clipHullAgainstHull(const btVector3& separatin
}
}
}
if (closestFaceB == -1 || closestFaceB >= hullB.m_faces.size())
return;
btVertexArray worldVertsB1;
{
const btFace& polyB = hullB.m_faces[closestFaceB];