Browse Source

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

Ivan Savenko 1 year ago
parent
commit
d8d652783a
1 changed files with 2 additions and 1 deletions
  1. 2 1
      server/battles/BattleFlowProcessor.cpp

+ 2 - 1
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;