Added if (texture) to fix bug when the dynamic_cast<> returns NULL.

This commit is contained in:
Robert Osfield
2016-06-17 09:24:13 +01:00
parent f5465e82a1
commit 234d6cf431

View File

@@ -233,9 +233,12 @@ public:
for(unsigned int i=0; i<stateset->getNumTextureAttributeLists(); ++i)
{
const osg::Texture* texture = dynamic_cast<const osg::Texture*>(stateset->getTextureAttribute(i, osg::StateAttribute::TEXTURE));
CostPair cost = _gce->estimateCompileCost(texture);
_costs.first += cost.first;
_costs.second += cost.second;
if (texture)
{
CostPair cost = _gce->estimateCompileCost(texture);
_costs.first += cost.first;
_costs.second += cost.second;
}
}
}