瀏覽代碼

Fix crash

nordsoft 3 年之前
父節點
當前提交
53b9434a22
共有 1 個文件被更改,包括 3 次插入2 次删除
  1. 3 2
      client/CPlayerInterface.cpp

+ 3 - 2
client/CPlayerInterface.cpp

@@ -443,14 +443,15 @@ void CPlayerInterface::heroKilled(const CGHeroInstance* hero)
 	}
 
 	wanderingHeroes -= hero;
-	if (vstd::contains(paths, hero))
-		paths.erase(hero);
 
 	adventureInt->heroList.update(hero);
 	if (makingTurn && newSelection)
 		adventureInt->select(newSelection, true);
 	else if (adventureInt->selection == hero)
 		adventureInt->selection = nullptr;
+	
+	if (vstd::contains(paths, hero))
+		paths.erase(hero);
 }
 
 void CPlayerInterface::heroVisit(const CGHeroInstance * visitor, const CGObjectInstance * visitedObj, bool start)