Merge pull request #11872 from xiaofeng11/v3

Fix ArmatureAnimation crash
This commit is contained in:
minggo 2015-05-18 13:32:52 +08:00
commit c2f245733c
1 changed files with 12 additions and 2 deletions

View File

@ -166,10 +166,20 @@ float ArmatureAnimation::getSpeedScale() const
void ArmatureAnimation::play(const std::string& animationName, int durationTo, int loop) void ArmatureAnimation::play(const std::string& animationName, int durationTo, int loop)
{ {
CCASSERT(_animationData, "_animationData can not be null"); if (animationName.empty())
{
CCLOG("_animationData can not be null");
return;
}
// CCASSERT(_animationData, "_animationData can not be null");
_movementData = _animationData->getMovement(animationName.c_str()); _movementData = _animationData->getMovement(animationName.c_str());
CCASSERT(_movementData, "_movementData can not be null"); if (nullptr == _movementData)
{
CCLOG("_movementData can not be null");
return;
}
// CCASSERT(_movementData, "_movementData can not be null");
//! Get key frame count //! Get key frame count
_rawDuration = _movementData->duration; _rawDuration = _movementData->duration;