]> git.mxchange.org Git - simgear.git/commitdiff
Fix a potential crash when OSG is misconfigured, and an appropriate image
authorjmt <jmt>
Fri, 26 Dec 2008 11:42:04 +0000 (11:42 +0000)
committerjmt <jmt>
Fri, 26 Dec 2008 11:42:04 +0000 (11:42 +0000)
loading plugin cannot be found.

simgear/scene/model/ModelRegistry.cxx

index d20ce3ed61b302314559877dbff385cc1af83c56..b19c853c12389940121086aaf921bf6783b573e8 100644 (file)
@@ -345,6 +345,11 @@ ModelRegistry::readImage(const string& fileName,
         Registry* registry = Registry::instance();
         ReaderWriter::ReadResult res;
         res = registry->readImageImplementation(absFileName, opt);
+        if (!res.success()) {
+          SG_LOG(SG_IO, SG_WARN, "Image loading failed:" << res.message());
+          return res;
+        }
+        
         if (res.loadedFromCache())
             SG_LOG(SG_IO, SG_INFO, "Returning cached image \""
                    << res.getImage()->getFileName() << "\"");