From e5144e9590087eac0ebd6604e9b44f6ee804b89d Mon Sep 17 00:00:00 2001 From: angstsmurf Date: Fri, 19 Jul 2019 23:58:15 +0200 Subject: COMPOSER: Don't crash when skipping invalid animations Don't try to run a NULL animation. Fixes a crash in Gregory. --- engines/composer/graphics.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/composer/graphics.cpp b/engines/composer/graphics.cpp index b95a6bc567..aa7ed7c143 100644 --- a/engines/composer/graphics.cpp +++ b/engines/composer/graphics.cpp @@ -151,8 +151,10 @@ void ComposerEngine::playAnimation(uint16 animId, int16 x, int16 y, int16 eventP Animation *anim = NULL; loadAnimation(anim, animId, x, y, eventParam); - _anims.push_back(anim); - runEvent(kEventAnimStarted, animId, eventParam, 0); + if (anim != NULL) { + _anims.push_back(anim); + runEvent(kEventAnimStarted, animId, eventParam, 0); + } } void ComposerEngine::stopAnimation(Animation *anim, bool localOnly, bool pipesOnly) { -- cgit v1.2.3