From 1719b56d8a4a08d75879716e12110c8e63485b36 Mon Sep 17 00:00:00 2001 From: Stedd Date: Sat, 5 Oct 2024 17:07:22 +0200 Subject: [PATCH] Fixed null error if there are no targets --- Assets/Entities/Scripts/Targeter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Assets/Entities/Scripts/Targeter.cs b/Assets/Entities/Scripts/Targeter.cs index 5d62f06..91c088d 100644 --- a/Assets/Entities/Scripts/Targeter.cs +++ b/Assets/Entities/Scripts/Targeter.cs @@ -36,6 +36,8 @@ namespace AsteroidGame.Entities public bool FindTarget() { + if (_activeTargetable == null || _activeTargetable.Count == 0) return false; + var currentBestValue = Mathf.Infinity; var targetFound = false;