Added extra check against a null vertex array to prevent a crash when

tri stripping an empty geometry.
This commit is contained in:
Robert Osfield
2004-03-29 12:28:06 +00:00
parent cad1e2a075
commit 9e4b23a1ef

View File

@@ -192,7 +192,6 @@ typedef osg::TriangleIndexFunctor<MyTriangleOperator> MyTriangleIndexFunctor;
void TriStripVisitor::stripify(Geometry& geom)
{
if (geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE ||
geom.getNormalBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
@@ -206,8 +205,7 @@ void TriStripVisitor::stripify(Geometry& geom)
geom.getFogCoordBinding()==osg::Geometry::BIND_PER_PRIMITIVE_SET) return;
// no point tri stripping if we don't have enough vertices.
if (geom.getVertexArray()->getNumElements()<3) return;
if (!geom.getVertexArray() || geom.getVertexArray()->getNumElements()<3) return;
// check to see if vertex attributes indices exists, if so expand them to remove them
if (geom.suitableForOptimization())