File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
RuriLib/Models/Blocks/Settings Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public Type EnumType
2727 set
2828 {
2929 _enumType = value ;
30-
30+
3131 // Populate the enum values dictionary (used to have nicer enum names to display)
3232 foreach ( var name in _enumType . GetEnumNames ( ) )
3333 {
@@ -54,11 +54,14 @@ public Type EnumType
5454 /// The pretty names of the enum values.
5555 /// </summary>
5656 public IEnumerable < string > PrettyNames => _enumValues . Keys ;
57-
57+
5858 /// <summary>
5959 /// The pretty name of the current value.
6060 /// </summary>
61- public string PrettyName => _enumValues . First ( kvp => kvp . Value == Value ) . Key ;
61+ public string PrettyName
62+ => _enumValues . ContainsValue ( Value )
63+ ? _enumValues . First ( kvp => kvp . Value == Value ) . Key
64+ : Value ;
6265
6366 /// <summary>
6467 /// Sets the value of the setting from a pretty name.
You can’t perform that action at this time.
0 commit comments