Skip dropdowns that have no valid options.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
07ef98a578
commit
ce41ec3fc3
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user