浏览代码

Merge pull request #661 from jambolo/bug/fix-0003154

Fixed potential race condition
Alexander Shishkin 5 年之前
父节点
当前提交
dfeb801425
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      client/battle/CBattleInterface.cpp

+ 2 - 2
client/battle/CBattleInterface.cpp

@@ -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();