From 576a2650958c0811528b333c2360e43cd5230152 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 30 Jun 2016 09:52:10 +0100 Subject: [PATCH] Added handlng of null dynamic_cast --- src/osgPlugins/gles/GeometryArray | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/gles/GeometryArray b/src/osgPlugins/gles/GeometryArray index 50d556a6f..6665ca8d5 100644 --- a/src/osgPlugins/gles/GeometryArray +++ b/src/osgPlugins/gles/GeometryArray @@ -15,7 +15,7 @@ struct GeometryArrayList { class ArrayIndexAppendVisitor : public osg::ArrayVisitor { public: - ArrayIndexAppendVisitor(const IndexList& indexes, osg::Array* dst): _indexes(indexes), _dst(dst) + ArrayIndexAppendVisitor(const IndexList& indexes, osg::Array* dst): _indexes(indexes), _dst(dst) { } @@ -31,6 +31,11 @@ struct GeometryArrayList { } T* dstArray = dynamic_cast(_dst); + if (!dstArray) { + osg::notify(osg::WARN) << "Incompatible array types, cannot not append together." << std::endl; + return; + } + for(IndexList::const_iterator it = _indexes.begin(); it != _indexes.end(); ++it) { unsigned int idx = *it; @@ -84,7 +89,7 @@ struct GeometryArrayList { return true; } return false; - } + } void operator()(osg::Array* src, unsigned int index, osg::Array* dst) {