From 0b01cc467606937722836d745fbc55ee50cb9629 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 22 Apr 2024 15:33:01 +0300 Subject: [PATCH] Fix possible crash on out-of-range access --- server/battles/BattleActionProcessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/battles/BattleActionProcessor.cpp b/server/battles/BattleActionProcessor.cpp index b57da0d99..012a9918b 100644 --- a/server/battles/BattleActionProcessor.cpp +++ b/server/battles/BattleActionProcessor.cpp @@ -760,7 +760,7 @@ int BattleActionProcessor::moveStack(const CBattleInfoCallback & battle, int sta //TODO we need find batter way to handle double-wide stacks //currently if only second occupied stack part is standing on gate / bridge hex then stack will start to wait for bridge to lower before it's needed. Though this is just a visual bug. - if (curStack->doubleWide()) + if (curStack->doubleWide() && i + 2 < path.first.size()) { BattleHex otherHex = curStack->occupiedHex(hex); if (otherHex.isValid() && needOpenGates(otherHex))