From bb58d349cbab63d655961cf0c07dc78b1869d476 Mon Sep 17 00:00:00 2001 From: John Bolton Date: Sat, 24 Oct 2020 23:38:39 -0700 Subject: [PATCH] Fixed potential race condition --- client/battle/CBattleInterface.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index 8dee01abf..f0f772a7b 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -49,10 +49,10 @@ CondSh CBattleInterface::givenCommand(nullptr); static void onAnimationFinished(const CStack *stack, std::weak_ptr anim) { - if(anim.expired()) + std::shared_ptr animation = anim.lock(); + if(!animation) return; - std::shared_ptr animation = anim.lock(); if (animation->isIdle()) { const CCreature *creature = stack->getCreature();