From bc9b28a0c95a9089e844ff10b2869664383011a0 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Sun, 14 Mar 2010 08:56:21 +0000 Subject: [PATCH] Added return into ReaderWriterOSG2::prepareReading(..) to prevent bug associated with result being discarded. --- src/osgPlugins/osg/ReaderWriterOSG2.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/osgPlugins/osg/ReaderWriterOSG2.cpp b/src/osgPlugins/osg/ReaderWriterOSG2.cpp index 70b74b547..2544eeaef 100644 --- a/src/osgPlugins/osg/ReaderWriterOSG2.cpp +++ b/src/osgPlugins/osg/ReaderWriterOSG2.cpp @@ -118,10 +118,18 @@ public: Options* prepareReading( ReadResult& result, std::string& fileName, const Options* options ) const { std::string ext = osgDB::getLowerCaseFileExtension( fileName ); - if ( !acceptsExtension(ext) ) result = ReadResult::FILE_NOT_HANDLED; + if ( !acceptsExtension(ext) ) + { + result = ReadResult::FILE_NOT_HANDLED; + return 0; + } fileName = osgDB::findDataFile( fileName, options ); - if ( fileName.empty() ) result = ReadResult::FILE_NOT_FOUND; - + if ( fileName.empty() ) + { + result = ReadResult::FILE_NOT_FOUND; + return 0; + } + osg::ref_ptr local_opt = options ? static_cast(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName));