From d8d652783a43027f3d568accf7f34aea1e6c10d5 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Wed, 2 Oct 2024 11:04:40 +0000 Subject: [PATCH] Fix crash on casting spell by a random spellcaster (e.g. Master Genie) --- server/battles/BattleFlowProcessor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/battles/BattleFlowProcessor.cpp b/server/battles/BattleFlowProcessor.cpp index ce70d21fd..7510b519a 100644 --- a/server/battles/BattleFlowProcessor.cpp +++ b/server/battles/BattleFlowProcessor.cpp @@ -571,7 +571,8 @@ void BattleFlowProcessor::onActionMade(const CBattleInfoCallback & battle, const assert(activeStack != nullptr); assert(actedStack != nullptr); - if(actedStack->castSpellThisTurn && SpellID(ba.spell).toSpell()->canCastWithoutSkip()) + // NOTE: in case of random spellcaster, (e.g. Master Genie) spell has been selected by server and was not present in action received from player + if(actedStack->castSpellThisTurn && ba.spell.hasValue() && ba.spell.toSpell()->canCastWithoutSkip()) { setActiveStack(battle, actedStack); return;