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,6 +52,8 @@ namespace OpenRA.Mods.Common.Traits.Sound
currentSounds.RemoveWhere(s => s == null || s.Complete); currentSounds.RemoveWhere(s => s == null || s.Complete);
if (self.OccupiesSpace != null)
{
var pos = self.CenterPosition; var pos = self.CenterPosition;
if (pos != cachedPosition) if (pos != cachedPosition)
{ {
@@ -60,6 +62,7 @@ namespace OpenRA.Mods.Common.Traits.Sound
cachedPosition = pos; cachedPosition = pos;
} }
}
if (delay < 0) if (delay < 0)
return; return;