1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fix crash on casting spell by a random spellcaster (e.g. Master Genie)

This commit is contained in:
Ivan Savenko 2024-10-02 11:04:40 +00:00
parent cef7466c71
commit d8d652783a

View File

@ -571,7 +571,8 @@ void BattleFlowProcessor::onActionMade(const CBattleInfoCallback & battle, const
assert(activeStack != nullptr); assert(activeStack != nullptr);
assert(actedStack != 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); setActiveStack(battle, actedStack);
return; return;