Fix simulator crash when add animation under a user defined lua extension

This commit is contained in:
XiaoFeng 2015-04-27 17:42:20 +08:00
parent 07725ce84d
commit 28264c0742
1 changed files with 11 additions and 8 deletions

View File

@ -225,7 +225,7 @@ void RotationFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void RotationFrame::onApply(float percent) void RotationFrame::onApply(float percent)
{ {
if (_betwennRotation != 0) if (nullptr != _node && _betwennRotation != 0)
{ {
float rotation = _rotation + percent * _betwennRotation; float rotation = _rotation + percent * _betwennRotation;
_node->setRotation(rotation); _node->setRotation(rotation);
@ -282,7 +282,7 @@ void SkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void SkewFrame::onApply(float percent) void SkewFrame::onApply(float percent)
{ {
if (_betweenSkewX != 0 || _betweenSkewY != 0) if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
{ {
float skewx = _skewX + percent * _betweenSkewX; float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY; float skewy = _skewY + percent * _betweenSkewY;
@ -342,7 +342,7 @@ void RotationSkewFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void RotationSkewFrame::onApply(float percent) void RotationSkewFrame::onApply(float percent)
{ {
if (_betweenSkewX != 0 || _betweenSkewY != 0) if (nullptr != _node && _betweenSkewX != 0 || _betweenSkewY != 0)
{ {
float skewx = _skewX + percent * _betweenSkewX; float skewx = _skewX + percent * _betweenSkewX;
float skewy = _skewY + percent * _betweenSkewY; float skewy = _skewY + percent * _betweenSkewY;
@ -400,7 +400,7 @@ void PositionFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void PositionFrame::onApply(float percent) void PositionFrame::onApply(float percent)
{ {
if (_betweenX != 0 || _betweenY != 0) if (nullptr != _node && _betweenX != 0 || _betweenY != 0)
{ {
Point p; Point p;
p.x = _position.x + _betweenX * percent; p.x = _position.x + _betweenX * percent;
@ -460,7 +460,7 @@ void ScaleFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void ScaleFrame::onApply(float percent) void ScaleFrame::onApply(float percent)
{ {
if (_betweenScaleX != 0 || _betweenScaleY != 0) if (nullptr != _node && _betweenScaleX != 0 || _betweenScaleY != 0)
{ {
float scaleX = _scaleX + _betweenScaleX * percent; float scaleX = _scaleX + _betweenScaleX * percent;
float scaleY = _scaleY + _betweenScaleY * percent; float scaleY = _scaleY + _betweenScaleY * percent;
@ -694,7 +694,7 @@ void ColorFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void ColorFrame::onApply(float percent) void ColorFrame::onApply(float percent)
{ {
if (_betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0) if (nullptr != _node && _betweenRed != 0 || _betweenGreen != 0 || _betweenBlue != 0)
{ {
Color3B color; Color3B color;
color.r = _color.r+ _betweenRed * percent; color.r = _color.r+ _betweenRed * percent;
@ -750,8 +750,11 @@ void AlphaFrame::onEnter(Frame *nextFrame, int currentFrameIndex)
void AlphaFrame::onApply(float percent) void AlphaFrame::onApply(float percent)
{ {
GLubyte alpha = _alpha + _betweenAlpha * percent; if (nullptr != _node)
_node->setOpacity(alpha); {
GLubyte alpha = _alpha + _betweenAlpha * percent;
_node->setOpacity(alpha);
}
} }
Frame* AlphaFrame::clone() Frame* AlphaFrame::clone()