diff --git a/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs b/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs index a4d2db5459..b8572a9bb2 100644 --- a/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs +++ b/OpenRA.Game/Widgets/Delegates/MusicPlayerDelegate.cs @@ -64,8 +64,20 @@ namespace OpenRA.Widgets.Delegates }; } - string GetNextSong() { return Rules.Music["allmusic"].Pool.GetNext(); } - string GetPrevSong() { return Rules.Music["allmusic"].Pool.GetPrev(); } - string GetSong() { return Rules.Music["allmusic"].Pool.GetCurrent(); } + string GetNextSong() + { + if (!Rules.Music.ContainsKey("allmusic")) return null; + return Rules.Music["allmusic"].Pool.GetNext(); + } + string GetPrevSong() + { + if (!Rules.Music.ContainsKey("allmusic")) return null; + return Rules.Music["allmusic"].Pool.GetPrev(); + } + string GetSong() + { + if (!Rules.Music.ContainsKey("allmusic")) return null; + return Rules.Music["allmusic"].Pool.GetCurrent(); + } } }