1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Fix potential crash in ShaderVisitor for textures with no image assigned

This commit is contained in:
scrawl 2017-02-08 19:16:07 +01:00
parent 43d9f3d5c7
commit 792f505b2a

View File

@ -152,7 +152,7 @@ namespace Shader
} }
} }
if (mAutoUseNormalMaps && diffuseMap != NULL && normalMap == NULL) if (mAutoUseNormalMaps && diffuseMap != NULL && normalMap == NULL && diffuseMap->getImage(0))
{ {
std::string normalMapFileName = diffuseMap->getImage(0)->getFileName(); std::string normalMapFileName = diffuseMap->getImage(0)->getFileName();
@ -194,7 +194,7 @@ namespace Shader
mRequirements.back().mNormalHeight = normalHeight; mRequirements.back().mNormalHeight = normalHeight;
} }
} }
if (mAutoUseSpecularMaps && diffuseMap != NULL && specularMap == NULL) if (mAutoUseSpecularMaps && diffuseMap != NULL && specularMap == NULL && diffuseMap->getImage(0))
{ {
std::string specularMapFileName = diffuseMap->getImage(0)->getFileName(); std::string specularMapFileName = diffuseMap->getImage(0)->getFileName();
boost::replace_last(specularMapFileName, ".", mSpecularMapPattern + "."); boost::replace_last(specularMapFileName, ".", mSpecularMapPattern + ".");