From cd44e63b9099e41855949a9f0371cb42cf03a9f8 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 21 Apr 2011 12:12:40 +0000 Subject: [PATCH] From Cedric Pinson, "I have tried some model that produces crashes in the dae plugin because of empty node: if (GetFloat4Param(cot->getParam()->getRef(), f4)) {...} in the model I have tested cot->getParam()->getRef() return 0x0 and make it crahes inside GetFloat4Param. I have added a test before calling GetFloat4Param if (cot->getParam()->getRef() != 0 && GetFloat4Param(cot->getParam()->getRef(), f4)) {...} " --- src/osgPlugins/dae/daeRMaterials.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgPlugins/dae/daeRMaterials.cpp b/src/osgPlugins/dae/daeRMaterials.cpp index c46c98e68..d3195ab61 100644 --- a/src/osgPlugins/dae/daeRMaterials.cpp +++ b/src/osgPlugins/dae/daeRMaterials.cpp @@ -618,7 +618,7 @@ bool daeReader::processColorOrTextureType(const osg::StateSet* ss, else if (cot->getParam() != NULL) { domFloat4 f4; - if (GetFloat4Param(cot->getParam()->getRef(), f4)) + if (cot->getParam()->getRef() != 0 && GetFloat4Param(cot->getParam()->getRef(), f4)) { mat->setAmbient( osg::Material::FRONT_AND_BACK, osg::Vec4( f4[0], f4[1], f4[2], f4[3] ) ); retVal = true;