1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Fixed potential race condition

This commit is contained in:
John Bolton
2020-10-24 23:38:39 -07:00
parent c0a5d1ccf0
commit bb58d349cb

View File

@@ -49,10 +49,10 @@ CondSh<BattleAction *> CBattleInterface::givenCommand(nullptr);
static void onAnimationFinished(const CStack *stack, std::weak_ptr<CCreatureAnimation> anim) static void onAnimationFinished(const CStack *stack, std::weak_ptr<CCreatureAnimation> anim)
{ {
if(anim.expired()) std::shared_ptr<CCreatureAnimation> animation = anim.lock();
if(!animation)
return; return;
std::shared_ptr<CCreatureAnimation> animation = anim.lock();
if (animation->isIdle()) if (animation->isIdle())
{ {
const CCreature *creature = stack->getCreature(); const CCreature *creature = stack->getCreature();