From aa9604663214f8ee3f04467678d2ef7ca1fc8d6e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 4 Sep 2015 14:34:45 +0000 Subject: [PATCH] From Julien Valentin, "Serializing custom geometry i ran into a crash due to a setVertexAttribArrayList(array) with array containing NULL vertexAttrib. I added a test in order to avoid it Code: void Geometry::setVertexAttribArrayList(const ArrayList& arrayList) { _vertexAttribList = arrayList; dirtyDisplayList(); if (_useVertexBufferObjects) { for(ArrayList::iterator itr = _vertexAttribList.begin(); itr != _vertexAttribList.end(); ++itr) { if(itr->get())//ADDED addVertexBufferObjectIfRequired(itr->get()); } } } " and "The bug i ran into is a crash reading osgt Geometry with null vertexattribs. The only thing i added is a not nul check on array passed to setVertexAttribArrayList." --------------------This line, and those below, will be ignored-- M src/osg/Geometry.cpp git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@15121 16af8721-9629-0410-8352-f15c8da7e697 --- src/osg/Geometry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osg/Geometry.cpp b/src/osg/Geometry.cpp index 36e167200..c1e20d094 100644 --- a/src/osg/Geometry.cpp +++ b/src/osg/Geometry.cpp @@ -201,7 +201,7 @@ void Geometry::setTexCoordArrayList(const ArrayList& arrayList) itr != _texCoordList.end(); ++itr) { - addVertexBufferObjectIfRequired(itr->get()); + if (itr->get()) addVertexBufferObjectIfRequired(itr->get()); } } } @@ -244,7 +244,7 @@ void Geometry::setVertexAttribArrayList(const ArrayList& arrayList) itr != _vertexAttribList.end(); ++itr) { - addVertexBufferObjectIfRequired(itr->get()); + if (itr->get()) addVertexBufferObjectIfRequired(itr->get()); } } }