Make sure strips have valid size

pull/541/head
capostrophic 5 years ago
parent 6599a28ecf
commit b4f54651f8

@ -63,7 +63,7 @@ void fillTriangleMeshWithTransform(btTriangleMesh& mesh, const Nif::NiTriStripsD
// Assume every strip has the same size
const int singleStripSize = static_cast<int>(strips[0].size());
// Can't make a triangle from 2 vertices or less.
// Can't make a triangle from less than three vertices.
if (singleStripSize < 3)
return;

@ -1128,6 +1128,10 @@ namespace NifOsg
{
for (const std::vector<unsigned short>& strip : data->strips)
{
// Can't make a triangle from less than three vertices.
// All strips have the same size.
if (strip.size() < 3)
break;
geometry->addPrimitiveSet(new osg::DrawElementsUShort(osg::PrimitiveSet::TRIANGLE_STRIP,
strip.size(), (unsigned short*)strip.data()));
}

Loading…
Cancel
Save