diff --git a/src/osgPlugins/osg/ReaderWriterOSG2.cpp b/src/osgPlugins/osg/ReaderWriterOSG2.cpp index 1618e8efe..41eb55cc8 100644 --- a/src/osgPlugins/osg/ReaderWriterOSG2.cpp +++ b/src/osgPlugins/osg/ReaderWriterOSG2.cpp @@ -148,7 +148,7 @@ public: std::ios::openmode mode = std::ios::in; Options* local_opt = prepareReading( result, fileName, mode, options ); if ( !result.success() ) return result; - + osgDB::ifstream istream( fileName.c_str(), mode ); return readObject( istream, local_opt ); } @@ -157,14 +157,17 @@ public: { osg::ref_ptr ii = readInputIterator(fin, options); if ( !ii ) return ReadResult::FILE_NOT_HANDLED; - + InputStream is( options ); - if ( is.start(ii.get())!=InputStream::READ_OBJECT ) + + osgDB::InputStream::ReadType readType = is.start(ii.get()); + if ( readType==InputStream::READ_UNKNOWN ) { CATCH_EXCEPTION(is); return ReadResult::FILE_NOT_HANDLED; } is.decompress(); CATCH_EXCEPTION(is); + osg::Object* obj = is.readObject(); CATCH_EXCEPTION(is); return obj; }