Fix a potential crash when OSG is misconfigured, and an appropriate image

loading plugin cannot be found.
This commit is contained in:
jmt
2008-12-26 11:42:04 +00:00
parent 74a4144193
commit ac57eab8ac

View 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() << "\"");