X3DImporter: fix coverity finding.
authorKim Kulling <kim.kulling@googlemail.com>
Wed, 24 May 2017 19:04:35 +0000 (21:04 +0200)
committerKim Kulling <kim.kulling@googlemail.com>
Wed, 24 May 2017 19:04:35 +0000 (21:04 +0200)
code/X3DImporter_Postprocess.cpp

index 996340f..0e3f3a8 100644 (file)
@@ -504,6 +504,9 @@ void X3DImporter::Postprocess_BuildMesh(const CX3DImporter_NodeElement& pNodeEle
                // copy additional information from children
                for(std::list<CX3DImporter_NodeElement*>::iterator ch_it = tnemesh.Child.begin(); ch_it != tnemesh.Child.end(); ch_it++)
                {
+                       if ( nullptr == *pMesh ) {
+                               break;
+                       }
                        if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_Color)
                                MeshGeometry_AddColor(**pMesh, ((CX3DImporter_NodeElement_Color*)*ch_it)->Value,tnemesh.ColorPerVertex);
                        else if((*ch_it)->Type == CX3DImporter_NodeElement::ENET_ColorRGBA)