From ac57eab8ac64401280c71fec26cdbfb5efed1ae7 Mon Sep 17 00:00:00 2001 From: jmt Date: Fri, 26 Dec 2008 11:42:04 +0000 Subject: [PATCH] Fix a potential crash when OSG is misconfigured, and an appropriate image loading plugin cannot be found. --- simgear/scene/model/ModelRegistry.cxx | 5 +++++ 1 file changed, 5 insertions(+) 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() << "\""); -- 2.39.5