From 3a1a6cf3384cf946b8d104a3af3b774945d8e801 Mon Sep 17 00:00:00 2001 From: Arseniy Shestakov Date: Tue, 9 Aug 2016 18:15:58 +0300 Subject: [PATCH] CBattleInterface: fix crash on defeat in tactics phase. Fix issue 2440 It's possible to lose all mobile stacks if you move them on moat so tactics phase must end in that case. --- client/battle/CBattleInterface.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client/battle/CBattleInterface.cpp b/client/battle/CBattleInterface.cpp index 88abab838..f90ea56ab 100644 --- a/client/battle/CBattleInterface.cpp +++ b/client/battle/CBattleInterface.cpp @@ -1935,6 +1935,12 @@ void CBattleInterface::bTacticNextStack(const CStack *current /*= nullptr*/) TStacks stacksOfMine = tacticianInterface->cb->battleGetStacks(CBattleCallback::ONLY_MINE); vstd::erase_if(stacksOfMine, &immobile); + if(stacksOfMine.empty()) + { + bEndTacticPhase(); + return; + } + auto it = vstd::find(stacksOfMine, current); if(it != stacksOfMine.end() && ++it != stacksOfMine.end()) stackActivated(*it);