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;