浏览代码

Fix running game without wog active

Ivan Savenko 5 月之前
父节点
当前提交
1b5d00cc99
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      lib/mapObjects/CGHeroInstance.cpp

+ 4 - 2
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<SecondarySkill> & skills)
 
 void CGHeroInstance::attachCommanderToArmy()
 {
-	commander->setArmy(this);
+	if (commander)
+		commander->setArmy(this);
 }
 
 void CGHeroInstance::levelUpAutomatically(vstd::RNG & rand)