From Michael Platings, "MorphGeometry fix: this fixes a crash found by Alessandro Terenzi"

This commit is contained in:
Robert Osfield
2010-06-01 15:20:30 +00:00
parent 656a1b6da5
commit 32e8f6adc3

View File

@@ -24,7 +24,7 @@
#include <osg/Geode>
#include <osgAnimation/MorphGeometry>
#include <stdlib.h>
#include <sstream>
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)
{