(ef2a86a63) Add a null check.

This commit is contained in:
Joonas Rikkonen
2019-05-16 06:45:53 +03:00
parent 496ee1492c
commit ce02152130
11 changed files with 346 additions and 167 deletions
@@ -503,8 +503,10 @@ namespace Barotrauma
public static void DoForEachCrewMember(Character character, Action<HumanAIController> action)
{
if (character == null) { return; }
foreach (var c in Character.CharacterList)
{
if (c == null || c.IsDead || c.Removed) { continue; }
if (c.AIController is HumanAIController humanAi && humanAi.IsFriendly(character))
{
action(humanAi);