1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Fix possible crash on out-of-range access

This commit is contained in:
Ivan Savenko 2024-04-22 15:33:01 +03:00
parent a1f4f3bd6e
commit 0b01cc4676

View File

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