From f5deda56a6a691dd65038d1d51df0a0f9aee61bd Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 2 Sep 2013 10:56:48 +0000 Subject: [PATCH] From Farshid Lashkari, "The ProxyNode serializer was not correctly reading the "Children" field. It conditionally writes the begin/end brackets, depending on whether it has children. However, during input it unconditionally attempts to read the begin/end brackets. I've modified the code to only read the brackets if it has children." --- src/osgWrappers/serializers/osg/ProxyNode.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/osgWrappers/serializers/osg/ProxyNode.cpp b/src/osgWrappers/serializers/osg/ProxyNode.cpp index 988fc2b76..1c6542e38 100644 --- a/src/osgWrappers/serializers/osg/ProxyNode.cpp +++ b/src/osgWrappers/serializers/osg/ProxyNode.cpp @@ -44,13 +44,17 @@ static bool checkChildren( const osg::ProxyNode& node ) static bool readChildren( osgDB::InputStream& is, osg::ProxyNode& 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; }