mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-07-05 12:08:16 +08:00
Fix issues with nullability and netstandard2.0
This commit is contained in:

committed by
Patrik Svensson

parent
7dce4af552
commit
a70cc90797
@ -85,7 +85,7 @@ internal static class CommandValueResolver
|
||||
}
|
||||
|
||||
// Assign the value to the parameter.
|
||||
binder.Bind(mapped.Parameter, resolver, converter.ConvertFromInvariantString(mapped.Value));
|
||||
binder.Bind(mapped.Parameter, resolver, converter.ConvertFromInvariantString(mapped.Value ?? string.Empty));
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,7 +130,13 @@ internal static class CommandValueResolver
|
||||
if (parameter.ParameterType.IsArray)
|
||||
{
|
||||
// Return a converter for each array item (not the whole array)
|
||||
return TypeDescriptor.GetConverter(parameter.ParameterType.GetElementType());
|
||||
var elementType = parameter.ParameterType.GetElementType();
|
||||
if (elementType == null)
|
||||
{
|
||||
throw new InvalidOperationException("Could not get element type");
|
||||
}
|
||||
|
||||
return TypeDescriptor.GetConverter(elementType);
|
||||
}
|
||||
|
||||
if (parameter.IsFlagValue())
|
||||
|
Reference in New Issue
Block a user