From b3f39bffce180b0331a3668da2f3138c7ce6a65f Mon Sep 17 00:00:00 2001 From: nvrnight Date: Thu, 31 Dec 2020 02:32:49 -0600 Subject: [PATCH] Issue #18936: The game no longer crashes when TextFieldWidget sends Enter key press and onSelect action is null. --- OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs index 231b09219d..06b46b4a24 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MapChooserLogic.cs @@ -43,7 +43,12 @@ namespace OpenRA.Mods.Common.Widgets.Logic this.modData = modData; this.onSelect = onSelect; - var approving = new Action(() => { Ui.CloseWindow(); onSelect(selectedUid); }); + var approving = new Action(() => + { + Ui.CloseWindow(); + onSelect?.Invoke(selectedUid); + }); + var canceling = new Action(() => { Ui.CloseWindow(); onExit(); }); var okButton = widget.Get("BUTTON_OK");