diff --git a/OpenRA.Game/WorldUtils.cs b/OpenRA.Game/WorldUtils.cs index 11f0bd7491..3422fe0eba 100755 --- a/OpenRA.Game/WorldUtils.cs +++ b/OpenRA.Game/WorldUtils.cs @@ -117,13 +117,15 @@ namespace OpenRA public static bool HasVoice(this Actor a) { - return a.Info.Traits.Contains() && a.Info.Traits.Get().Voice != null; + var selectable = a.Info.Traits.GetOrDefault(); + return selectable != null && selectable.Voice != null; } public static VoiceInfo GetVoice(this Actor a) { - if (!a.Info.Traits.Contains()) return null; - var v = a.Info.Traits.Get().Voice; + var selectable = a.Info.Traits.GetOrDefault(); + if (selectable == null) return null; + var v = selectable.Voice; return (v == null) ? null : Rules.Voices[v]; }