From 2a0e9d31e10b3a9643f982516259be82a6154134 Mon Sep 17 00:00:00 2001 From: ThorstenB Date: Sat, 11 Feb 2012 09:54:53 +0100 Subject: [PATCH] #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. --- simgear/scene/material/TextureBuilder.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) 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 << "'"); + } } } -- 2.39.5