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.
This commit is contained in:
Zachary Schirm
2022-09-08 17:57:45 -04:00
committed by Gustas
parent ee0d958cd1
commit 125a7b8c88

View File

@@ -39,7 +39,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
portField.Text = text.Substring(last + 1); 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)); var port = Exts.WithDefault(1234, () => Exts.ParseIntegerInvariant(portField.Text));