diff --git a/OpenRA.Game/Sound/Sound.cs b/OpenRA.Game/Sound/Sound.cs index 5a776eed1b..f05c1d7d7d 100644 --- a/OpenRA.Game/Sound/Sound.cs +++ b/OpenRA.Game/Sound/Sound.cs @@ -88,14 +88,12 @@ namespace OpenRA if (sounds != null) foreach (var soundSource in sounds.Values) - soundSource.Dispose(); + if (soundSource != null) + soundSource.Dispose(); getSoundSource = s => LoadSound(loaders, fileSystem, s); sounds = new Cache(getSoundSource); currentSounds = new Dictionary(); - music = null; - musicSource = null; - currentMusic = null; video = null; } @@ -236,13 +234,15 @@ namespace OpenRA { soundEngine.StopSound(music); soundEngine.ReleaseSound(music); - music = null; - musicSource.Dispose(); - musicSource = null; } - MusicPlaying = false; + if (musicSource != null) + musicSource.Dispose(); + + music = null; + musicSource = null; currentMusic = null; + MusicPlaying = false; } public void PauseMusic()