Added check against the NodePath being empty.

This commit is contained in:
Robert Osfield
2011-02-11 09:18:36 +00:00
parent a55c3be960
commit e3225a2c4b

View File

@@ -167,7 +167,7 @@ void NodeTrackerManipulator::computeNodeCenterAndRotation(osg::Vec3d& nodeCenter
computeNodeWorldToLocal(worldToLocal);
osg::NodePath nodePath;
if (_trackNodePath.getNodePath(nodePath))
if (_trackNodePath.getNodePath(nodePath) && !nodePath.empty())
nodeCenter = osg::Vec3d(nodePath.back()->getBound().center())*localToWorld;
else
nodeCenter = osg::Vec3d(0.0f,0.0f,0.0f)*localToWorld;