diff --git a/OpenRA.Mods.Common/ActorIndex.cs b/OpenRA.Mods.Common/ActorIndex.cs index f438e0ceb1..4075bbd4de 100644 --- a/OpenRA.Mods.Common/ActorIndex.cs +++ b/OpenRA.Mods.Common/ActorIndex.cs @@ -116,7 +116,7 @@ namespace OpenRA.Mods.Common protected override bool ShouldIndexActor(Actor actor) { - return names.Contains(actor.Info.Name) && actor.TraitOrDefault() != null; + return names.Contains(actor.Info.Name) && actor.TraitsImplementing().Any(); } } @@ -145,7 +145,7 @@ namespace OpenRA.Mods.Common protected override bool ShouldIndexActor(Actor actor) { - return actor.Owner == owner && names.Contains(actor.Info.Name) && actor.TraitOrDefault() != null; + return actor.Owner == owner && names.Contains(actor.Info.Name) && actor.TraitsImplementing().Any(); } } }