diff --git a/src/osgAnimation/MorphGeometry.cpp b/src/osgAnimation/MorphGeometry.cpp index 093e099b2..8cabc9ffa 100644 --- a/src/osgAnimation/MorphGeometry.cpp +++ b/src/osgAnimation/MorphGeometry.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include using namespace osgAnimation; @@ -255,9 +255,15 @@ bool UpdateMorph::link(osgAnimation::Channel* channel) { // Typically morph geometries only have the weights for morph targets animated - // Expect a weight value - // TODO Should we make this more generic to handle other things than single values? - int weightIndex = atoi(channel->getName().c_str()); + std::istringstream iss(channel->getName()); + + int weightIndex; + iss >> weightIndex; + + if (iss.fail()) + { + return false; + } if (weightIndex >= 0) {