From 125a7b8c884e406cfcdd7f680755aa7f695e4a30 Mon Sep 17 00:00:00 2001 From: Zachary Schirm Date: Thu, 8 Sep 2022 17:57:45 -0400 Subject: [PATCH] Disallow Join button without IP address input Disallow join button without IP address Input Closes #20234 Trying to join a server with an empty address crashes the game. This fix disallows pressing join button without ip address field input. Updated to reuse search for joinButton vs 2 separate calls to search. --- OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs index 88d8d311b0..c4e03715d2 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs @@ -39,7 +39,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic portField.Text = text.Substring(last + 1); } - panel.Get("JOIN_BUTTON").OnClick = () => + var joinButton = panel.Get("JOIN_BUTTON"); + + joinButton.IsDisabled = () => string.IsNullOrEmpty(ipField.Text); + + joinButton.OnClick = () => { var port = Exts.WithDefault(1234, () => Exts.ParseIntegerInvariant(portField.Text));