From 234d6cf4318e94b383a56e08cdf777152bf97759 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 17 Jun 2016 09:24:13 +0100 Subject: [PATCH] Added if (texture) to fix bug when the dynamic_cast<> returns NULL. --- src/osg/GraphicsCostEstimator.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/osg/GraphicsCostEstimator.cpp b/src/osg/GraphicsCostEstimator.cpp index f835cb57c..36fec361e 100644 --- a/src/osg/GraphicsCostEstimator.cpp +++ b/src/osg/GraphicsCostEstimator.cpp @@ -233,9 +233,12 @@ public: for(unsigned int i=0; igetNumTextureAttributeLists(); ++i) { const osg::Texture* texture = dynamic_cast(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; + } } }