mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-15 13:14:17 +01:00
console: correctly treat null default values, return result from commands
This commit is contained in:
parent
0f2aaa4241
commit
c0867d887e
1 changed files with 4 additions and 2 deletions
|
|
@ -384,6 +384,9 @@ internal partial class ConsoleManager : IServiceType
|
||||||
/// <exception cref="ArgumentException">Thrown if the given type cannot be handled by the console system.</exception>
|
/// <exception cref="ArgumentException">Thrown if the given type cannot be handled by the console system.</exception>
|
||||||
protected static ArgumentInfo TypeToArgument(Type type, object? defaultValue = null)
|
protected static ArgumentInfo TypeToArgument(Type type, object? defaultValue = null)
|
||||||
{
|
{
|
||||||
|
// If the default value is DBNull, we want to treat it as null
|
||||||
|
defaultValue = defaultValue == DBNull.Value ? null : defaultValue;
|
||||||
|
|
||||||
if (type == typeof(string))
|
if (type == typeof(string))
|
||||||
return new ArgumentInfo(ConsoleArgumentType.String, defaultValue);
|
return new ArgumentInfo(ConsoleArgumentType.String, defaultValue);
|
||||||
|
|
||||||
|
|
@ -462,8 +465,7 @@ internal partial class ConsoleManager : IServiceType
|
||||||
/// <inheritdoc cref="ConsoleEntry.Invoke" />
|
/// <inheritdoc cref="ConsoleEntry.Invoke" />
|
||||||
public override bool Invoke(IEnumerable<object> arguments)
|
public override bool Invoke(IEnumerable<object> arguments)
|
||||||
{
|
{
|
||||||
this.func.DynamicInvoke(arguments.ToArray());
|
return (bool)this.func.DynamicInvoke(arguments.ToArray())!;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue