fix HACD crash, thanks to gjaegy
See https://github.com/bulletphysics/bullet3/pull/277
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include "assert.h"
|
||||||
|
|
||||||
bool gCancelRequest=false;
|
bool gCancelRequest=false;
|
||||||
namespace HACD
|
namespace HACD
|
||||||
@@ -437,7 +438,8 @@ namespace HACD
|
|||||||
for(size_t v = 1; v < nV; ++v)
|
for(size_t v = 1; v < nV; ++v)
|
||||||
{
|
{
|
||||||
ptIndex = verticesCH.GetHead()->GetData().m_name;
|
ptIndex = verticesCH.GetHead()->GetData().m_name;
|
||||||
ch->AddPoint(m_points[ptIndex], ptIndex);
|
if (ptIndex != ICHull::sc_dummyIndex/* && ptIndex < m_nPoints*/)
|
||||||
|
ch->AddPoint(m_points[ptIndex], ptIndex);
|
||||||
verticesCH.Next();
|
verticesCH.Next();
|
||||||
}
|
}
|
||||||
delete gE.m_convexHull;
|
delete gE.m_convexHull;
|
||||||
@@ -845,3 +847,5 @@ namespace HACD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -265,7 +265,9 @@ namespace HACD
|
|||||||
// delete remaining points
|
// delete remaining points
|
||||||
while (!vertices.GetData().m_tag)
|
while (!vertices.GetData().m_tag)
|
||||||
{
|
{
|
||||||
vertices.Delete();
|
if (vertices.GetHead() == m_dummyVertex)
|
||||||
|
m_dummyVertex = 0;
|
||||||
|
vertices.Delete();
|
||||||
}
|
}
|
||||||
if (m_isFlat)
|
if (m_isFlat)
|
||||||
{
|
{
|
||||||
@@ -563,6 +565,8 @@ namespace HACD
|
|||||||
// if no faces visible from p then p is inside the hull
|
// if no faces visible from p then p is inside the hull
|
||||||
if (!visible && markVisibleFaces)
|
if (!visible && markVisibleFaces)
|
||||||
{
|
{
|
||||||
|
if (vertices.GetHead() == m_dummyVertex)
|
||||||
|
m_dummyVertex = 0;
|
||||||
vertices.Delete();
|
vertices.Delete();
|
||||||
m_trianglesToDelete.clear();
|
m_trianglesToDelete.clear();
|
||||||
return false;
|
return false;
|
||||||
@@ -741,7 +745,9 @@ namespace HACD
|
|||||||
if (v->GetData().m_tag && !v->GetData().m_onHull)
|
if (v->GetData().m_tag && !v->GetData().m_onHull)
|
||||||
{
|
{
|
||||||
CircularListElement<TMMVertex> * tmp = v->GetPrev();
|
CircularListElement<TMMVertex> * tmp = v->GetPrev();
|
||||||
vertices.Delete(v);
|
if (tmp == m_dummyVertex)
|
||||||
|
m_dummyVertex = 0;
|
||||||
|
vertices.Delete(v);
|
||||||
v = tmp;
|
v = tmp;
|
||||||
addedPoints--;
|
addedPoints--;
|
||||||
}
|
}
|
||||||
@@ -1010,3 +1016,4 @@ namespace HACD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user