From c20d71c9aff9a6980bf115eaae2c8ed03bc3f962 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 6 Nov 2011 11:38:44 +1300 Subject: [PATCH] make CncLobbyLogic tolerant of missing music button --- OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs index bc168a604b..ffac1a4c00 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/CncLobbyLogic.cs @@ -190,13 +190,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic chatTemplate = chatPanel.GetWidget("CHAT_TEMPLATE"); chatPanel.RemoveChildren(); - lobby.GetWidget("MUSIC_BUTTON").OnClick = () => - { - Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs() - { - { "onExit", () => {} }, - }); - }; + var musicButton = lobby.GetWidget("MUSIC_BUTTON"); + if (musicButton != null) + musicButton.OnClick = () => Widget.OpenWindow("MUSIC_PANEL", new WidgetArgs + { { "onExit", () => {} } }); // Add a bot on the first lobbyinfo update if (addBots)