Skip to content

Commit

Permalink
Disallow Join button without IP address input
Browse files Browse the repository at this point in the history
Disallow join button without IP address Input

Closes OpenRA#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.
  • Loading branch information
The-Zen-Cat authored and PunkPun committed Sep 9, 2022
1 parent dbfbd2e commit 20e00c1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public DirectConnectLogic(Widget widget, Action onExit, Action openLobby, Connec
portField.Text = text.Substring(last + 1);
}

panel.Get<ButtonWidget>("JOIN_BUTTON").OnClick = () =>
var joinButton = panel.Get<ButtonWidget>("JOIN_BUTTON");

joinButton.IsDisabled = () => string.IsNullOrEmpty(ipField.Text);

joinButton.OnClick = () =>
{
var port = Exts.WithDefault(1234, () => Exts.ParseIntegerInvariant(portField.Text));
Expand Down

0 comments on commit 20e00c1

Please sign in to comment.