From cf66750d7b2c0a19e5f79f98721111eb911332a6 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 2 May 2014 09:12:36 +0000 Subject: [PATCH] From Farshid Lashkari, "fix for the Collada loader where it would access a null string in some cases" --- src/osgPlugins/dae/daeRMaterials.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/dae/daeRMaterials.cpp b/src/osgPlugins/dae/daeRMaterials.cpp index 02c920537..bedec1a95 100644 --- a/src/osgPlugins/dae/daeRMaterials.cpp +++ b/src/osgPlugins/dae/daeRMaterials.cpp @@ -296,9 +296,10 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) // // 0 // - if (strcmp(TechniqueArray[CurrentTechnique]->getProfile(), "GOOGLEEARTH") == 0) + const domTechniqueRef& TechniqueRef = TechniqueArray[CurrentTechnique]; + if (TechniqueRef->getProfile() && strcmp(TechniqueRef->getProfile(), "GOOGLEEARTH") == 0) { - const daeElementRefArray& ElementArray = TechniqueArray[CurrentTechnique]->getContents(); + const daeElementRefArray& ElementArray = TechniqueRef->getContents(); size_t NumberOfElements = ElementArray.getCount(); size_t CurrentElement; for (CurrentElement = 0; CurrentElement < NumberOfElements; CurrentElement++) @@ -307,7 +308,7 @@ void daeReader::processProfileCOMMON(osg::StateSet *ss, domProfile_COMMON *pc ) if (strcmp(pAny->getElementName(), "double_sided") == 0) { daeString Value = pAny->getValue(); - if (strcmp(Value, "1") == 0) + if (Value && strcmp(Value, "1") == 0) ss->setMode( GL_CULL_FACE, osg::StateAttribute::OFF ); } }