1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-17 20:58:07 +02:00

Merge pull request #4709 from IvanSavenko/genie_fix

Fix crash on casting spell by a random spellcaster (e.g. Master Genie)
This commit is contained in:
Ivan Savenko 2024-10-06 16:00:00 +03:00 committed by GitHub
commit f3af32b912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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