From: jmt Date: Fri, 26 Dec 2008 11:42:04 +0000 (+0000) Subject: Fix a potential crash when OSG is misconfigured, and an appropriate image X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=ac57eab8ac64401280c71fec26cdbfb5efed1ae7;p=simgear.git Fix a potential crash when OSG is misconfigured, and an appropriate image loading plugin cannot be found. --- diff --git a/simgear/scene/model/ModelRegistry.cxx b/simgear/scene/model/ModelRegistry.cxx index d20ce3ed..b19c853c 100644 --- a/simgear/scene/model/ModelRegistry.cxx +++ b/simgear/scene/model/ModelRegistry.cxx @@ -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() << "\"");