mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Fix crash on attacking town with garrison but without defending heroes
This commit is contained in:
@@ -310,7 +310,7 @@ void CGTownInstance::onHeroVisit(IGameEventCallback & gameEvents, const CGHeroIn
|
||||
const CArmedInstance * defendingArmy = defendingHero ? static_cast<const CArmedInstance*>(defendingHero) : this;
|
||||
const bool isBattleOutside = isBattleOutsideTown(defendingHero);
|
||||
|
||||
if(!isBattleOutside && defendingHero == getVisitingHero())
|
||||
if(!isBattleOutside && defendingHero && defendingHero == getVisitingHero())
|
||||
mergeGarrisonOnSiege(gameEvents);
|
||||
|
||||
gameEvents.startBattle(h, defendingArmy, getSightCenter(), h, defendingHero, BattleLayout::createDefaultLayout(*cb, h, defendingArmy), (isBattleOutside ? nullptr : this));
|
||||
|
||||
Reference in New Issue
Block a user