Fixed nullrefs in command parsing
This commit is contained in:
@@ -156,7 +156,7 @@ namespace Discord.Commands
|
|||||||
return ParseResult.FromError(CommandError.ParseFailed, "A quoted parameter is incomplete");
|
return ParseResult.FromError(CommandError.ParseFailed, "A quoted parameter is incomplete");
|
||||||
|
|
||||||
//Add missing optionals
|
//Add missing optionals
|
||||||
for (int i = paramList.Count; i < command.Parameters.Count; i++)
|
for (int i = argList.Count; i < command.Parameters.Count; i++)
|
||||||
{
|
{
|
||||||
var param = command.Parameters[i];
|
var param = command.Parameters[i];
|
||||||
if (!param.IsOptional)
|
if (!param.IsOptional)
|
||||||
|
|||||||
@@ -41,9 +41,13 @@ namespace Discord.Commands
|
|||||||
var argList = new TypeReaderResult[argValues.Count];
|
var argList = new TypeReaderResult[argValues.Count];
|
||||||
for (int i = 0; i < argValues.Count; i++)
|
for (int i = 0; i < argValues.Count; i++)
|
||||||
argList[i] = TypeReaderResult.FromSuccess(argValues[i]);
|
argList[i] = TypeReaderResult.FromSuccess(argValues[i]);
|
||||||
var paramList = new TypeReaderResult[paramValues.Count];
|
TypeReaderResult[] paramList = null;
|
||||||
for (int i = 0; i < paramValues.Count; i++)
|
if (paramValues != null)
|
||||||
paramList[i] = TypeReaderResult.FromSuccess(paramValues[i]);
|
{
|
||||||
|
paramList = new TypeReaderResult[paramValues.Count];
|
||||||
|
for (int i = 0; i < paramValues.Count; i++)
|
||||||
|
paramList[i] = TypeReaderResult.FromSuccess(paramValues[i]);
|
||||||
|
}
|
||||||
return new ParseResult(argList, paramList, null, null);
|
return new ParseResult(argList, paramList, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user