diff --git a/src/osgUtil/Optimizer.cpp b/src/osgUtil/Optimizer.cpp index 86a7e4da1..8b0e1986a 100644 --- a/src/osgUtil/Optimizer.cpp +++ b/src/osgUtil/Optimizer.cpp @@ -1956,12 +1956,13 @@ bool Optimizer::MergeGeometryVisitor::mergeGroup(osg::Group& group) ++mitr) { DuplicateList& duplicateList = *mitr; - if (duplicateList.size()>1) + if (!duplicateList.empty()) { - osg::ref_ptr lhs = duplicateList.front(); + DuplicateList::iterator ditr = duplicateList.begin(); + osg::ref_ptr lhs = *ditr++; group.addChild(lhs.get()); - for(DuplicateList::iterator ditr = duplicateList.begin()+1; + for(; ditr != duplicateList.end(); ++ditr) {