From 729f85017526a5b4263775981d299b32608c9c89 Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Fri, 26 Jan 2018 17:28:39 +0200 Subject: [PATCH] Fixed a "sequence contains no elements" exception in IndoorsSteeringManager --- .../Source/Characters/AI/IndoorsSteeringManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs index 3e0f20f84..b3a25d3db 100644 --- a/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs +++ b/Barotrauma/BarotraumaShared/Source/Characters/AI/IndoorsSteeringManager.cs @@ -109,9 +109,9 @@ namespace Barotrauma if (currentPath.Finished) { Vector2 pos2 = host.SimPosition; - if (character != null && character.Submarine == null && CurrentPath.Nodes.Last().Submarine != null) + if (character != null && character.Submarine == null && + CurrentPath.Nodes.Count > 0 && CurrentPath.Nodes.Last().Submarine != null) { - //todo: take multiple subs into account pos2 -= CurrentPath.Nodes.Last().Submarine.SimPosition; } return currentTarget - pos2;