From: ThorstenB Date: Sat, 11 Feb 2012 08:54:53 +0000 (+0100) Subject: #658: avoid crash when Textures.high is missing X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=2a0e9d31e10b3a9643f982516259be82a6154134;p=simgear.git #658: avoid crash when Textures.high is missing Don't resolve the empty file name, which would result in the fgdata directory path (instead of a path to a file). Eventually this resulted in a segfault, partly due to a bug in "osgDB::readImageFile", which reports "success" when given a directory (instead of a file) path, though it doesn't return a valid image object. --- diff --git a/simgear/scene/material/TextureBuilder.cxx b/simgear/scene/material/TextureBuilder.cxx index 0c141c47..ad3ad569 100644 --- a/simgear/scene/material/TextureBuilder.cxx +++ b/simgear/scene/material/TextureBuilder.cxx @@ -216,11 +216,14 @@ TexTuple makeTexTuple(Effect* effect, const SGPropertyNode* props, if (pImage) { imageName = pImage->getStringValue(); - absFileName = SGModelLib::findDataFile(imageName, options); - if (absFileName.empty()) + if (!imageName.empty()) { - SG_LOG(SG_INPUT, SG_ALERT, "Texture file not found: '" - << imageName << "'"); + absFileName = SGModelLib::findDataFile(imageName, options); + if (absFileName.empty()) + { + SG_LOG(SG_INPUT, SG_ALERT, "Texture file not found: '" + << imageName << "'"); + } } }