diff --git a/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs index 0006782cfa6c..c4e03715d237 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs @@ -39,9 +39,11 @@ public DirectConnectLogic(Widget widget, Action onExit, Action openLobby, Connec portField.Text = text.Substring(last + 1); } - panel.Get("JOIN_BUTTON").IsDisabled = () => string.IsNullOrEmpty(ipField.Text); + var joinButton = panel.Get("JOIN_BUTTON"); - panel.Get("JOIN_BUTTON").OnClick = () => + joinButton.IsDisabled = () => string.IsNullOrEmpty(ipField.Text); + + joinButton.OnClick = () => { var port = Exts.WithDefault(1234, () => Exts.ParseIntegerInvariant(portField.Text));