Skip dropdowns that have no valid options.

This commit is contained in:
Paul Chote
2025-04-19 14:14:47 +01:00
committed by Gustas Kažukauskas
parent 07ef98a578
commit ce41ec3fc3
2 changed files with 2 additions and 2 deletions

View File

@@ -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;

View File

@@ -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<LabelWidget>("LABEL");