diff --git a/src/Unit.cpp b/src/Unit.cpp index 130eaa3185e6bb8428500bcdbd13cb98f1f59d56..09277056f6eb331b642a7d2ac067879f25ea4a32 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) == nullptr) { + if (m_bot->GetUnit(t_id).isValid()) { return *this; }