From 7cb8ca174ecf0c1a5392248fac42cb2c78d83278 Mon Sep 17 00:00:00 2001 From: kdmcser Date: Sun, 17 Nov 2024 00:28:25 +0800 Subject: [PATCH] fix crash: defender is killed by spell before attack, but attacker still do attack action --- server/battles/BattleActionProcessor.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/battles/BattleActionProcessor.cpp b/server/battles/BattleActionProcessor.cpp index 6c0799cbd..6855fd6c9 100644 --- a/server/battles/BattleActionProcessor.cpp +++ b/server/battles/BattleActionProcessor.cpp @@ -916,6 +916,10 @@ void BattleActionProcessor::makeAttack(const CBattleInfoCallback & battle, const if(defender && first && !counter) handleAttackBeforeCasting(battle, ranged, attacker, defender); + // If the attacker or defender is not alive before the attack action, the action should be skipped. + if((attacker && !attacker->alive()) || (defender && !defender->alive())) + return; + FireShieldInfo fireShield; BattleAttack bat; BattleLogMessage blm;