fix a crash when reading an osgt file with multiple references to a missing texture.

This commit is contained in:
Laurens Voerman 2017-04-07 15:27:56 +02:00
parent 43891d6cc1
commit 4bc855b610

View File

@ -858,12 +858,13 @@ osg::ref_ptr<osg::Image> InputStream::readImage(bool readFromExternal)
}
else
{
image = readObjectFieldsOfType<osg::Image>("osg::Object", id, image.get());
image = readObjectFieldsOfType<osg::Image>("osg::Object", id, image.get());// leaves _identifierMap[id] pointing at DummyObject if image invalid
if ( image.valid() )
{
image->setFileName( name );
image->setWriteHint( (osg::Image::WriteHint)writeHint );
}
_identifierMap[id] = image;//valid or invalid, don't leave this pointing at an osg::Dummyobject as it's used with a static_cast when recycled
}
return image;
}