diff --git a/src/osgPlugins/txp/ReaderWriterTXP.cpp b/src/osgPlugins/txp/ReaderWriterTXP.cpp index 385762120..e8591d48d 100644 --- a/src/osgPlugins/txp/ReaderWriterTXP.cpp +++ b/src/osgPlugins/txp/ReaderWriterTXP.cpp @@ -870,7 +870,9 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int osg::Group* tileGroup = archive->getTileContent(x,y,lod,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); // if group has only one child, then simply use its child. - while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) + // if the node is a transform, then stop processing so as to not loose the transformation + while (tileGroup && !tileGroup->asTransform() && + tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) { tileGroup = tileGroup->getChild(0)->asGroup(); } @@ -882,7 +884,7 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, int doSeam = (lod < (archive->getNumLODs() - 1)); // Handle seams - if (doSeam) + if (tileGroup && doSeam) { SeamFinder sfv(x,y,lod,info,archive); tileGroup->accept(sfv); @@ -906,13 +908,15 @@ osg::Node* ReaderWriterTXP::getTileContent(const TXPArchive::TileInfo &info, con osg::Group* tileGroup = archive->getTileContent(loc,realMinRange,realMaxRange,usedMaxRange,tileCenter, childrenLoc); // if group has only one child, then simply use its child. - while (tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) + // if the node is a transform, then stop processing so as to not loose the transformation + while (tileGroup && !tileGroup->asTransform() && + tileGroup->getNumChildren()==1 && tileGroup->getChild(0)->asGroup()) { tileGroup = tileGroup->getChild(0)->asGroup(); } // Handle seams - if (childrenLoc.size() > 0) + if (tileGroup && childrenLoc.size() > 0) { SeamFinder sfv(loc.x, loc.y, loc.lod, info, archive); tileGroup->accept(sfv);