Fix null ref during load.
This happened a few times
This commit is contained in:
@@ -485,9 +485,11 @@ SGCloudLayer::rebuild()
|
|||||||
// repaint the cloud layer colors
|
// repaint the cloud layer colors
|
||||||
bool SGCloudLayer::repaint( const SGVec3f& fog_color ) {
|
bool SGCloudLayer::repaint( const SGVec3f& fog_color ) {
|
||||||
osg::Vec4f combineColor(toOsg(fog_color), cloud_alpha);
|
osg::Vec4f combineColor(toOsg(fog_color), cloud_alpha);
|
||||||
osg::TexEnvCombine* combiner
|
osg::StateAttribute* textureAtt = layer_root->getStateSet()->getTextureAttribute(1, osg::StateAttribute::TEXENV);
|
||||||
= dynamic_cast<osg::TexEnvCombine*>(layer_root->getStateSet()
|
osg::TexEnvCombine* combiner = dynamic_cast<osg::TexEnvCombine*>(textureAtt);
|
||||||
->getTextureAttribute(1, osg::StateAttribute::TEXENV));
|
|
||||||
|
if (combiner == nullptr)
|
||||||
|
return false;
|
||||||
combiner->setConstantColor(combineColor);
|
combiner->setConstantColor(combineColor);
|
||||||
|
|
||||||
// Set the fog color for the 3D clouds too.
|
// Set the fog color for the 3D clouds too.
|
||||||
|
|||||||
Reference in New Issue
Block a user