Fixed null pointer check

This commit is contained in:
Robert Osfield 2016-07-06 20:13:36 +01:00
parent 84eca67498
commit b907a6e1a6

View File

@ -161,9 +161,8 @@ protected:
}
inline osg::Array* makeVertexBuffer(const osg::Array* array, bool copyUserData=true) {
osg::Array* buffer = 0;
if(array) {
buffer = dynamic_cast<osg::Array*>(array->cloneType());
osg::Array* buffer = array ? osg::cloneType(array) : 0;
if(buffer) {
buffer->setBinding(osg::Array::BIND_PER_VERTEX);
if(copyUserData && array->getUserDataContainer()) {
buffer->setUserDataContainer(osg::clone(array->getUserDataContainer(), osg::CopyOp::DEEP_COPY_ALL));