Skip to content

Commit

Permalink
Merge pull request #9 from SamirKharchi/Fix-Enum-Bug
Browse files Browse the repository at this point in the history
Fixes a crash scenario when the enum was not set or null
  • Loading branch information
SamirKharchi authored May 11, 2021
2 parents 13a9a9f + 5ed5fbf commit f5811bd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ public EnumDescriptionConverter(Type enumType)
}

object IValueConverter.Convert(object value, Type targetType, object parameter, CultureInfo culture) =>
cache.First(x => x.Key.Equals((Enum) value)).Value;
cache.FirstOrDefault(x => x.Key.Equals((Enum) value)).Value;

object IValueConverter.ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) =>
cache.First(x => x.Value == (string) value).Key;
cache.FirstOrDefault(x => x.Value == (string) value).Key;
}
}
}

0 comments on commit f5811bd

Please sign in to comment.