Skip to content

Commit

Permalink
Disallow join button without IP address Input
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
The-Zen-Cat committed Sep 8, 2022
1 parent 9698465 commit 818a4f8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions OpenRA.Mods.Common/Widgets/Logic/DirectConnectLogic.cs
Expand Up @@ -39,9 +39,11 @@ public DirectConnectLogic(Widget widget, Action onExit, Action openLobby, Connec
portField.Text = text.Substring(last + 1);
}

panel.Get<ButtonWidget>("JOIN_BUTTON").IsDisabled = () => string.IsNullOrEmpty(ipField.Text);
var joinButton = panel.Get<ButtonWidget>("JOIN_BUTTON");

panel.Get<ButtonWidget>("JOIN_BUTTON").OnClick = () =>
joinButton.IsDisabled = () => string.IsNullOrEmpty(ipField.Text);

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

0 comments on commit 818a4f8

Please sign in to comment.