From c5cdfa1a1db4a99b526f8b1116d6d5bd71f01ce6 Mon Sep 17 00:00:00 2001 From: Richard Harrison Date: Sat, 21 Jan 2017 00:54:01 +0100 Subject: [PATCH] Prevent null pointer deference when load has failed. This was triggered by the TU154B; probably related to the console error * "Image loading failed:Warning: reading "fgdata\AI\Aircraft\tu154b\Model" not supported. --- simgear/scene/model/SGMaterialAnimation.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/simgear/scene/model/SGMaterialAnimation.cxx b/simgear/scene/model/SGMaterialAnimation.cxx index 0169f574..9f7bb733 100644 --- a/simgear/scene/model/SGMaterialAnimation.cxx +++ b/simgear/scene/model/SGMaterialAnimation.cxx @@ -450,7 +450,8 @@ SGMaterialAnimation::createAnimationGroup(osg::Group& parent) stateSet->setTextureAttribute(0, texture2D, osg::StateAttribute::OVERRIDE); stateSet->setTextureMode(0, GL_TEXTURE_2D, osg::StateAttribute::ON); - if (texture2D->getImage()->isImageTranslucent()) { + osg::ref_ptr textureImage = texture2D->getImage(); + if (textureImage && textureImage->isImageTranslucent()) { stateSet->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); stateSet->setMode(GL_BLEND, osg::StateAttribute::ON); }