diff --git a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs index 01ff400d68..6beac6f5cf 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Lobby/LobbyLogic.cs @@ -105,10 +105,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic bool updateDiscordStatus = true; Dictionary spawnOccupants = new(); - readonly string chatLineSound = ChromeMetrics.Get("ChatLineSound"); - readonly string playerJoinedSound = ChromeMetrics.Get("PlayerJoinedSound"); - readonly string playerLeftSound = ChromeMetrics.Get("PlayerLeftSound"); - readonly string lobbyOptionChangedSound = ChromeMetrics.Get("LobbyOptionChangedSound"); + readonly string chatLineSound; + readonly string playerJoinedSound; + readonly string playerLeftSound; + readonly string lobbyOptionChangedSound; bool MapIsPlayable => (mapStatus & Session.MapStatus.Playable) == Session.MapStatus.Playable; @@ -170,6 +170,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic Game.BeforeGameStart += OnGameStart; Game.ConnectionStateChanged += ConnectionStateChanged; + ChromeMetrics.TryGet("ChatLineSound", out chatLineSound); + ChromeMetrics.TryGet("PlayerJoinedSound", out playerJoinedSound); + ChromeMetrics.TryGet("PlayerLeftSound", out playerLeftSound); + ChromeMetrics.TryGet("LobbyOptionChangedSound", out lobbyOptionChangedSound); + var name = lobby.GetOrNull("SERVER_NAME"); if (name != null) name.GetText = () => orderManager.LobbyInfo.GlobalSettings.ServerName;