Skip to content

Commit

Permalink
Add default nullable enum typereader (#1518)
Browse files Browse the repository at this point in the history
  • Loading branch information
SubZero0 committed Nov 24, 2021
1 parent 6abdfcb commit f7a07ae
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Discord.Net.Commands/CommandService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,13 @@ internal TypeReader GetDefaultTypeReader(Type type)
_defaultTypeReaders[type] = reader;
return reader;
}
var underlyingType = Nullable.GetUnderlyingType(type);
if (underlyingType != null && underlyingType.IsEnum)
{
reader = NullableTypeReader.Create(underlyingType, EnumTypeReader.GetReader(underlyingType));
_defaultTypeReaders[type] = reader;
return reader;
}

//Is this an entity?
for (int i = 0; i < _entityTypeReaders.Count; i++)
Expand Down

0 comments on commit f7a07ae

Please sign in to comment.