diff --git a/OpenRA.Mods.RA/Cloak.cs b/OpenRA.Mods.RA/Cloak.cs index 98eaf414ce..164ed785d0 100644 --- a/OpenRA.Mods.RA/Cloak.cs +++ b/OpenRA.Mods.RA/Cloak.cs @@ -68,18 +68,19 @@ namespace OpenRA.Mods.RA canCloak = (e.DamageState < DamageState.Critical); if (Cloaked && !canCloak) DoUncloak(); - } - + } + + static readonly Renderable[] Nothing = { }; public IEnumerable ModifyRender(Actor self, IEnumerable rs) { if (remainingTime > 0) - return rs; - - if (Cloaked && IsVisible(self)) - return rs.Select(a => a.WithPalette("shadow")); - else - return new Renderable[] { }; + return rs; + + if (Cloaked && IsVisible(self)) + return rs.Select(a => a.WithPalette("shadow")); + else + return Nothing; } public void Tick(Actor self) @@ -103,7 +104,7 @@ namespace OpenRA.Mods.RA public bool IsVisible(Actor self) { - if (!Cloaked || self.Owner == self.World.LocalPlayer || self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) + if (!Cloaked || self.Owner == self.World.LocalPlayer || self.World.LocalPlayer == null || self.Owner.Stances[self.World.LocalPlayer] == Stance.Ally) return true; return self.World.Queries.WithTrait().Any(a => (self.Location - a.Actor.Location).Length < a.Actor.Info.Traits.Get().Range);