]> git.mxchange.org Git - simgear.git/commitdiff
#658: avoid crash when Textures.high is missing
authorThorstenB <brehmt@gmail.com>
Sat, 11 Feb 2012 08:54:53 +0000 (09:54 +0100)
committerThorstenB <brehmt@gmail.com>
Sat, 11 Feb 2012 09:00:03 +0000 (10:00 +0100)
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

index 0c141c475c3415b627c354ad8cb53b4a1d52eb69..ad3ad56909d22366de1d57a3373ecf311fa27af1 100644 (file)
@@ -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 << "'");
+            }
         }
     }