From ce41ec3fc3a6067ff5b766a4184bdce1212f07bc Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sat, 19 Apr 2025 14:14:47 +0100 Subject: [PATCH] Skip dropdowns that have no valid options. --- OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs | 2 +- .../Widgets/Logic/Editor/MapGeneratorToolLogic.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs b/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs index d6e0bea9d7..0fb9db434f 100644 --- a/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs +++ b/OpenRA.Mods.Common/MapGenerator/MapGeneratorSettings.cs @@ -133,7 +133,7 @@ namespace OpenRA.Mods.Common.MapGenerator get => value; set { - if (!Choices.ContainsKey(value)) + if (value != null && !Choices.ContainsKey(value)) throw new ArgumentException($"{value} is not in the list of valid choices"); this.value = value; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapGeneratorToolLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapGeneratorToolLogic.cs index 2f693b9beb..8d863035e6 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Editor/MapGeneratorToolLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Editor/MapGeneratorToolLogic.cs @@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic if (!validChoices.Contains(mo.Value)) mo.Value = mo.Default?.FirstOrDefault(validChoices.Contains) ?? validChoices.FirstOrDefault(); - if (mo.Label != null && validChoices.Count > 0) + if (mo.Value != null && mo.Label != null && validChoices.Count > 0) { settingWidget = dropDownSettingTemplate.Clone(); var labelWidget = settingWidget.Get("LABEL");