From d087a160427d897d9f32bc4fd2d70457eebe1ece Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 25 Jan 2016 16:44:17 +0100 Subject: [PATCH] Fix a crash in d2k caused by empty bounds This adds respective checks to Building.cs. --- OpenRA.Mods.Common/Traits/Buildings/Building.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Buildings/Building.cs b/OpenRA.Mods.Common/Traits/Buildings/Building.cs index 00eb6e3449..cd8432bda1 100644 --- a/OpenRA.Mods.Common/Traits/Buildings/Building.cs +++ b/OpenRA.Mods.Common/Traits/Buildings/Building.cs @@ -183,14 +183,18 @@ namespace OpenRA.Mods.Common.Traits { self.World.ActorMap.AddInfluence(self, this); self.World.ActorMap.AddPosition(self, this); - self.World.ScreenMap.Add(self); + + if (!self.Bounds.Size.IsEmpty) + self.World.ScreenMap.Add(self); } public void RemovedFromWorld(Actor self) { self.World.ActorMap.RemoveInfluence(self, this); self.World.ActorMap.RemovePosition(self, this); - self.World.ScreenMap.Remove(self); + + if (!self.Bounds.Size.IsEmpty) + self.World.ScreenMap.Remove(self); } public void NotifyBuildingComplete(Actor self)