浏览代码

GatherTroops: avoid crash if nearest dwelling wasn't found. Issue 2624

Arseniy Shestakov 9 年之前
父节点
当前提交
fd3992ddc9
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      AI/VCAI/Goals.cpp

+ 2 - 0
AI/VCAI/Goals.cpp

@@ -929,6 +929,8 @@ TSubgoal GatherTroops::whatToDoToAchieve()
 
 		// find hero who is nearest to a dwelling
 		const CGDwelling * nearest = boost::range::min_element(nearestDwellings, comparator)->second;
+		if(nearest) // FIXME: Find out what regression / bug cause this. Issue 2624
+			throw cannotFulfillGoalException("Cannot find nearest dwelling!");
 
 		return sptr (Goals::GetObj(nearest->id.getNum()));
 	}