From 1b5d00cc996d4d49f1a6ba8c44c44938de013cf2 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Tue, 6 May 2025 18:53:21 +0300 Subject: [PATCH] Fix running game without wog active --- lib/mapObjects/CGHeroInstance.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/mapObjects/CGHeroInstance.cpp b/lib/mapObjects/CGHeroInstance.cpp index 93aaf57d6..b1994614e 100644 --- a/lib/mapObjects/CGHeroInstance.cpp +++ b/lib/mapObjects/CGHeroInstance.cpp @@ -1337,7 +1337,8 @@ void CGHeroInstance::restoreBonusSystem(CGameState & gs) { CArmedInstance::restoreBonusSystem(gs); artDeserializationFix(gs, this); - this->commander->artDeserializationFix(gs, this->commander.get()); + if (commander) + commander->artDeserializationFix(gs, this->commander.get()); if (boardedBoat.hasValue()) { auto boat = gs.getObjInstance(boardedBoat); @@ -1613,7 +1614,8 @@ void CGHeroInstance::levelUp(const std::vector & skills) void CGHeroInstance::attachCommanderToArmy() { - commander->setArmy(this); + if (commander) + commander->setArmy(this); } void CGHeroInstance::levelUpAutomatically(vstd::RNG & rand)