Fixed a "sequence contains no elements" exception in IndoorsSteeringManager

This commit is contained in:
Joonas Rikkonen
2018-01-26 17:28:39 +02:00
parent 5e4eef3915
commit 729f850175
@@ -109,9 +109,9 @@ namespace Barotrauma
if (currentPath.Finished) if (currentPath.Finished)
{ {
Vector2 pos2 = host.SimPosition; 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; pos2 -= CurrentPath.Nodes.Last().Submarine.SimPosition;
} }
return currentTarget - pos2; return currentTarget - pos2;