From 3c0d963b3ee2159c6ddfa86ebc7b341513cd0d05 Mon Sep 17 00:00:00 2001
From: eriah592 <eriah592@student.liu.se>
Date: Thu, 10 Oct 2019 12:14:36 +0200
Subject: [PATCH] added fix for unit debugg crash

---
 src/Unit.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Unit.cpp b/src/Unit.cpp
index 0bb94a978..d20d062fb 100644
--- a/src/Unit.cpp
+++ b/src/Unit.cpp
@@ -328,7 +328,9 @@ void Unit::ability(sc2::AbilityID ability, const Unit& target) const
 Unit Unit::getTarget() const
 {
     BOT_ASSERT(isValid(), "Unit is not valid");
-    BOT_ASSERT(hasTarget(), "Unit has no target");
+    if (!hasTarget()){
+	return NULL
+    }
 
     // if unit has order, check tag of target of first order
     if(getUnitPtr()->orders.size() > 0){
-- 
GitLab