mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-17 00:07:41 +02:00
Fix game crash at AI turn
This commit is contained in:
@ -108,7 +108,10 @@ void TurnTimerHandler::onBattleNextStack(const CStack & stack)
|
|||||||
{
|
{
|
||||||
const auto * gs = gameHandler.gameState();
|
const auto * gs = gameHandler.gameState();
|
||||||
const auto * si = gameHandler.getStartInfo();
|
const auto * si = gameHandler.getStartInfo();
|
||||||
if(!si || !gs)
|
if(!si || !gs || !gs->curB)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(!stack.getOwner().isValidPlayer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto & state = gs->players.at(stack.getOwner());
|
const auto & state = gs->players.at(stack.getOwner());
|
||||||
@ -133,7 +136,7 @@ void TurnTimerHandler::onBattleLoop(int waitTime)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
const auto * stack = gs->curB.get()->battleGetStackByID(gs->curB->getActiveStackID());
|
const auto * stack = gs->curB.get()->battleGetStackByID(gs->curB->getActiveStackID());
|
||||||
if(!stack)
|
if(!stack || !stack->getOwner().isValidPlayer())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto & state = gs->players.at(gs->curB->getSidePlayer(stack->unitSide()));
|
auto & state = gs->players.at(gs->curB->getSidePlayer(stack->unitSide()));
|
||||||
|
Reference in New Issue
Block a user