From a76d86a3429c0203efe7932207bb48322eb92548 Mon Sep 17 00:00:00 2001 From: whiterandrek Date: Sat, 9 Jun 2018 16:00:23 +0300 Subject: PINK: add check to startFrame because it can be greater than sprite's frames number --- engines/pink/objects/actions/action_play.cpp | 1 + engines/pink/objects/actions/action_still.cpp | 2 ++ 2 files changed, 3 insertions(+) (limited to 'engines/pink') diff --git a/engines/pink/objects/actions/action_play.cpp b/engines/pink/objects/actions/action_play.cpp index 9e9c856da4..9af1900e32 100644 --- a/engines/pink/objects/actions/action_play.cpp +++ b/engines/pink/objects/actions/action_play.cpp @@ -58,6 +58,7 @@ void ActionPlay::pause(bool paused) { void ActionPlay::onStart() { debug("Actor %s has now ActionPlay %s", _actor->getName().c_str(), _name.c_str()); _decoder->start(); + assert(_startFrame <= _decoder->getFrameCount()); for (uint i = 0; i < _startFrame; ++i) { _decoder->skipFrame(); } diff --git a/engines/pink/objects/actions/action_still.cpp b/engines/pink/objects/actions/action_still.cpp index 693d1304d4..78f0949591 100644 --- a/engines/pink/objects/actions/action_still.cpp +++ b/engines/pink/objects/actions/action_still.cpp @@ -48,6 +48,8 @@ void ActionStill::pause(bool paused) {} void ActionStill::onStart() { debug("Actor %s has now ActionStill %s", _actor->getName().c_str(), _name.c_str()); + if (_startFrame >= _decoder->getFrameCount()) + _startFrame = 0; for (uint i = 0; i < _startFrame; ++i) { _decoder->skipFrame(); } -- cgit v1.2.3