Fix a potential crash when OSG is misconfigured, and an appropriate image
loading plugin cannot be found.
This commit is contained in:
@@ -345,6 +345,11 @@ ModelRegistry::readImage(const string& fileName,
|
|||||||
Registry* registry = Registry::instance();
|
Registry* registry = Registry::instance();
|
||||||
ReaderWriter::ReadResult res;
|
ReaderWriter::ReadResult res;
|
||||||
res = registry->readImageImplementation(absFileName, opt);
|
res = registry->readImageImplementation(absFileName, opt);
|
||||||
|
if (!res.success()) {
|
||||||
|
SG_LOG(SG_IO, SG_WARN, "Image loading failed:" << res.message());
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
if (res.loadedFromCache())
|
if (res.loadedFromCache())
|
||||||
SG_LOG(SG_IO, SG_INFO, "Returning cached image \""
|
SG_LOG(SG_IO, SG_INFO, "Returning cached image \""
|
||||||
<< res.getImage()->getFileName() << "\"");
|
<< res.getImage()->getFileName() << "\"");
|
||||||
|
|||||||
Reference in New Issue
Block a user