From 9e4b23a1ef5b959a55345b98c6c576f8b141b054 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 29 Mar 2004 12:28:06 +0000 Subject: [PATCH] Added extra check against a null vertex array to prevent a crash when tri stripping an empty geometry. --- src/osgUtil/TriStripVisitor.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/osgUtil/TriStripVisitor.cpp b/src/osgUtil/TriStripVisitor.cpp index d890f5fd4..62f5b5464 100644 --- a/src/osgUtil/TriStripVisitor.cpp +++ b/src/osgUtil/TriStripVisitor.cpp @@ -192,7 +192,6 @@ typedef osg::TriangleIndexFunctor 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())