From Farshid Lashkari, "I've attached a small fix to the Collada loader which prevents a null pointer access in some cases."

This commit is contained in:
Robert Osfield 2014-04-24 17:26:46 +00:00
parent 77f1c58345
commit 7b4d7cd221

View File

@ -200,10 +200,18 @@ void daeReader::processBindMaterial( domBind_material *bm, domGeometry *geom, os
// 0..* <extra> // 0..* <extra>
void daeReader::processMaterial(osg::StateSet *ss, domMaterial *mat ) void daeReader::processMaterial(osg::StateSet *ss, domMaterial *mat )
{ {
_currentInstance_effect = mat->getInstance_effect(); if (!mat)
if (mat && mat->getName()) { {
return;
}
if (mat->getName()) {
ss->setName(mat->getName()); ss->setName(mat->getName());
} }
_currentInstance_effect = mat->getInstance_effect();
if (!_currentInstance_effect)
{
return;
}
domEffect *effect = daeSafeCast< domEffect >( getElementFromURI( _currentInstance_effect->getUrl() ) ); domEffect *effect = daeSafeCast< domEffect >( getElementFromURI( _currentInstance_effect->getUrl() ) );
if (effect) if (effect)
{ {