From c61c3d5500a4bd239b6699e6f3ca003be592f59f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 16 Apr 2015 10:07:23 +0000 Subject: [PATCH] Fixed crash when AntiSquish node is the root of the scene graph. git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/trunk@14840 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgManipulator/AntiSquish.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osgManipulator/AntiSquish.cpp b/src/osgManipulator/AntiSquish.cpp index 68115a714..9ba61164e 100644 --- a/src/osgManipulator/AntiSquish.cpp +++ b/src/osgManipulator/AntiSquish.cpp @@ -98,8 +98,10 @@ bool AntiSquish::computeUnSquishedMatrix(osg::Matrix& unsquished) const OpenThreads::ScopedLock lock( _cacheLock ); osg::NodePathList nodePaths = getParentalNodePaths(); - osg::NodePath np; - if (!nodePaths.empty()) np = nodePaths.front(); + if (nodePaths.empty()) return false; + + osg::NodePath np = nodePaths.front(); + if (np.empty()) return false; // Remove the last node which is the anti squish node itself. np.pop_back();