The segfault is triggered when OSG connot find a plugin which can load
the image, such as because of a wrong or unset OSG_LIBRARY_PATH
environment variable.

In that case, res.getImage() is NULL and dereferencing NULL gives the
segfault.

Index: simgear/scene/model/model.cxx
===================================================================
RCS file: /var/cvs/SimGear-0.3/source/simgear/scene/model/model.cxx,v
retrieving revision 1.55
diff -u -p -r1.55 model.cxx
--- simgear/scene/model/model.cxx	3 Jun 2007 18:21:04 -0000	1.55
+++ simgear/scene/model/model.cxx	18 Jul 2007 12:12:26 -0000
@@ -193,12 +193,17 @@ public:
     osgDB::Registry* registry = osgDB::Registry::instance();
     osgDB::ReaderWriter::ReadResult res;
     res = registry->readImageImplementation(absFileName, opt);
-    if (res.loadedFromCache())
-      SG_LOG(SG_IO, SG_INFO, "Returning cached image \""
-             << res.getImage()->getFileName() << "\"");
-    else
-      SG_LOG(SG_IO, SG_INFO, "Reading image \""
-             << res.getImage()->getFileName() << "\"");
+    if (res.getImage()) {
+      if (res.loadedFromCache())
+	SG_LOG(SG_IO, SG_INFO, "Returning cached image \""
+	       << res.getImage()->getFileName() << "\"");
+      else
+	SG_LOG(SG_IO, SG_INFO, "Reading image \""
+	       << res.getImage()->getFileName() << "\"");
+    } else {
+      SG_LOG(SG_IO, SG_INFO, "Reading image \"" << fileName 
+	     << "\" failed");
+    }
 
     return res;
   }

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Flightgear-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to