fix NRE when adding parameters thru builders (#1946)

This commit is contained in:
Quin Lynch
2021-11-25 11:23:33 -04:00
committed by GitHub
parent d5f5ae132c
commit 143ca6db43

View File

@@ -54,7 +54,7 @@ namespace Discord.Commands.Builders
if (type.GetTypeInfo().IsValueType) if (type.GetTypeInfo().IsValueType)
DefaultValue = Activator.CreateInstance(type); DefaultValue = Activator.CreateInstance(type);
else if (type.IsArray) else if (type.IsArray)
type = ParameterType.GetElementType(); DefaultValue = Array.CreateInstance(type.GetElementType(), 0);
ParameterType = type; ParameterType = type;
} }