From b83e7dae9062d4bd5e0d613436aa98c027bdb52a Mon Sep 17 00:00:00 2001 From: Mark Vejvoda Date: Thu, 19 Sep 2013 17:32:36 +0000 Subject: [PATCH] added null checks --- source/glest_game/world/map.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index b41093516..2b2bb8651 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -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;