From 94735a8364a28867860ab3a05a295fcd3b14c2f4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 5 Sep 2013 10:08:09 +0000 Subject: [PATCH] From Laurens Voerman, "like the "Bug in ProxyNode serializer" Farshid Lashkari found (svn submit 13754) the PagedLOD serializer attempts to read begin and and brackets. Fix is identical (don't read brackets when num_chidren is zero) and applies both to trunk and 3.2 branch." --- src/osgWrappers/serializers/osg/PagedLOD.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/osgWrappers/serializers/osg/PagedLOD.cpp b/src/osgWrappers/serializers/osg/PagedLOD.cpp index b91ee6e10..e74c9e658 100644 --- a/src/osgWrappers/serializers/osg/PagedLOD.cpp +++ b/src/osgWrappers/serializers/osg/PagedLOD.cpp @@ -96,13 +96,17 @@ static bool checkChildren( const osg::PagedLOD& node ) static bool readChildren( osgDB::InputStream& is, osg::PagedLOD& node ) { - unsigned int size = 0; is >> size >> is.BEGIN_BRACKET; - for ( unsigned int i=0; i> size; + if (size > 0) { - osg::Node* child = dynamic_cast( is.readObject() ); - if ( child ) node.addChild( child ); + is >> is.BEGIN_BRACKET; + for ( unsigned int i=0; i( is.readObject() ); + if ( child ) node.addChild( child ); + } + is >> is.END_BRACKET; } - is >> is.END_BRACKET; return true; }