added null checks

This commit is contained in:
Mark Vejvoda 2013-09-19 17:32:36 +00:00
parent bbe7042b2d
commit b83e7dae90

View File

@ -1188,6 +1188,13 @@ const Unit * Map::findClosestUnitToPos(const Selection *selection, Vec2i origina
}
Vec2i Map::findBestBuildApproach(const Unit *unit, Vec2i originalBuildPos,const UnitType *ut) const {
if(unit == NULL) {
throw megaglest_runtime_error("unit == NULL");
}
if(ut == NULL) {
throw megaglest_runtime_error("ut == NULL");
}
Vec2i unitBuilderPos = unit->getPosNotThreadSafe();
Vec2i pos = originalBuildPos;