From 7b4d7cd2215094ca9517336b13b0713ffc13bee9 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 24 Apr 2014 17:26:46 +0000 Subject: [PATCH] From Farshid Lashkari, "I've attached a small fix to the Collada loader which prevents a null pointer access in some cases." --- src/osgPlugins/dae/daeRMaterials.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/osgPlugins/dae/daeRMaterials.cpp b/src/osgPlugins/dae/daeRMaterials.cpp index 9e7e216f7..02c920537 100644 --- a/src/osgPlugins/dae/daeRMaterials.cpp +++ b/src/osgPlugins/dae/daeRMaterials.cpp @@ -200,10 +200,18 @@ void daeReader::processBindMaterial( domBind_material *bm, domGeometry *geom, os // 0..* void daeReader::processMaterial(osg::StateSet *ss, domMaterial *mat ) { - _currentInstance_effect = mat->getInstance_effect(); - if (mat && mat->getName()) { + if (!mat) + { + return; + } + if (mat->getName()) { ss->setName(mat->getName()); } + _currentInstance_effect = mat->getInstance_effect(); + if (!_currentInstance_effect) + { + return; + } domEffect *effect = daeSafeCast< domEffect >( getElementFromURI( _currentInstance_effect->getUrl() ) ); if (effect) {