Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth committed Oct 17, 2024
1 parent aeb5089 commit c167e66
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,11 @@ private void InitializeFlagsAndConstants(IEnumerable<Type> flags, IEnumerable<Ty

foreach (var flagType in bitflagType.GetCustomAttributes<FlagsForAttribute>(true))
{
if (_flagsMapping.ContainsKey(flagType.Tag))
if (!_flagsMapping.TryAdd(flagType.Tag, bitflagType))
{
throw new NotSupportedException($"Multiple bitflag enums declared for the tag {flagType.Tag}.");
}

_flagsMapping.Add(flagType.Tag, bitflagType);

var highestBit = bitflagType
.GetEnumValues()
.Cast<int>()
Expand Down

0 comments on commit c167e66

Please sign in to comment.