Don't crash when putting the trait on the World actor.

This commit is contained in:
Matthias Mailänder
2020-05-18 22:57:43 +02:00
committed by reaperrr
parent 3ab4a584ab
commit 672bd2d9fe

View File

@@ -52,13 +52,16 @@ namespace OpenRA.Mods.Common.Traits.Sound
currentSounds.RemoveWhere(s => s == null || s.Complete);
var pos = self.CenterPosition;
if (pos != cachedPosition)
if (self.OccupiesSpace != null)
{
foreach (var s in currentSounds)
s.SetPosition(pos);
var pos = self.CenterPosition;
if (pos != cachedPosition)
{
foreach (var s in currentSounds)
s.SetPosition(pos);
cachedPosition = pos;
cachedPosition = pos;
}
}
if (delay < 0)