From ab1b4e9efc56d3fa87c312e4637c45298cb1e9fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Czeka=C5=84ski?= Date: Sun, 26 Apr 2020 14:12:54 +0200 Subject: [PATCH] Fix going to target in goToTarget method Disabled trying to retrieve moves from empty movement list. --- src/AI/AutomaticMovement.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/AI/AutomaticMovement.py b/src/AI/AutomaticMovement.py index fc411af..8f958c9 100644 --- a/src/AI/AutomaticMovement.py +++ b/src/AI/AutomaticMovement.py @@ -28,7 +28,8 @@ class AutomaticMovement: self.targetCoords = (self.actualTarget.rect.x - self.leftUiWidth, self.actualTarget.rect.y) self.movesList = self.a_Star() if self.movesList is not None: - self.nextMove = self.movesList[0] + if len(self.movesList) > 0: + self.nextMove = self.movesList[0] else: self.actualTarget = None