From ba3eaa83e01d35417dfb0aea2436cdc3460ac3d2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 30 Jun 2016 10:08:29 +0100 Subject: [PATCH] Added handling of null dynamic_cast --- src/osgPlugins/gles/GeometrySplitterVisitor | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/osgPlugins/gles/GeometrySplitterVisitor b/src/osgPlugins/gles/GeometrySplitterVisitor index da7ce1b5f..321252435 100644 --- a/src/osgPlugins/gles/GeometrySplitterVisitor +++ b/src/osgPlugins/gles/GeometrySplitterVisitor @@ -215,11 +215,14 @@ protected: if (!primitivesToFix.empty()) { // filter all indices > _maxIndexValue in primitives for (unsigned int i = 0; i < primitivesToFix.size(); i++) { - osg::DrawElements* source = primitivesToFix[i].get(); - osg::DrawElements* large = removeLargeIndices(dynamic_cast(source)); - reportedPrimitives.push_back(large); - geomPrimitives.push_back(source); - setValidIndices(validIndices, source); + osg::DrawElementsUInt* source = dynamic_cast(primitivesToFix[i].get()); + if (source) + { + osg::DrawElements* large = removeLargeIndices(source); + reportedPrimitives.push_back(large); + geomPrimitives.push_back(source); + setValidIndices(validIndices, source); + } } }