diff --git a/src/Unit.cpp b/src/Unit.cpp
index 09277056f6eb331b642a7d2ac067879f25ea4a32..d8e48206494be69f496d1085e64a3c4b0e234c4b 100644
--- a/src/Unit.cpp
+++ b/src/Unit.cpp
@@ -341,7 +341,7 @@ Unit Unit::getTarget() const
 		CCUnitID t_id = getUnitPtr()->orders[0].target_unit_tag;
 
 		// if it doesn't have a target. Return itself
-		if (m_bot->GetUnit(t_id).isValid()) {
+		if (!this->hasTarget()) {
 			return *this;
 		}