1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Fixed crash on ending battle with a draw

This commit is contained in:
Ivan Savenko
2023-07-22 22:04:12 +03:00
parent a912770e29
commit 5aa2492a90

View File

@ -2208,19 +2208,25 @@ void BattleResultAccepted::applyGs(CGameState * gs) const
res.hero->removeBonusesRecursive(Bonus::OneBattle); res.hero->removeBonusesRecursive(Bonus::OneBattle);
} }
// Grow up growing artifacts if(winnerSide != 2)
if(const auto hero = heroResult[winnerSide].hero)
{ {
if(hero->commander && hero->commander->alive) // Grow up growing artifacts
const auto hero = heroResult[winnerSide].hero;
if (hero)
{ {
for(auto & art : hero->commander->artifactsWorn) if(hero->commander && hero->commander->alive)
{
for(auto & art : hero->commander->artifactsWorn)
art.second.artifact->growingUp();
}
for(auto & art : hero->artifactsWorn)
{
art.second.artifact->growingUp(); art.second.artifact->growingUp();
} }
for(auto & art : hero->artifactsWorn)
{
art.second.artifact->growingUp();
} }
} }
if(VLC->settings()->getBoolean(EGameSettings::MODULE_STACK_EXPERIENCE)) if(VLC->settings()->getBoolean(EGameSettings::MODULE_STACK_EXPERIENCE))
{ {
if(heroResult[0].army) if(heroResult[0].army)