From 586a019fbf5fcd383f514eabf9b5cd3670e62736 Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Mon, 3 Nov 2014 00:09:39 -0800 Subject: [PATCH] commands: Fixed Request#CheckArguments not erroring when required arguments were missing --- commands/request.go | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/commands/request.go b/commands/request.go index 974f97ff3..ea21d4720 100644 --- a/commands/request.go +++ b/commands/request.go @@ -107,7 +107,19 @@ var converters = map[reflect.Kind]converter{ func (r *request) CheckArguments(args []Argument) error { var argDef Argument - for i, arg := range r.arguments { + var length int + if len(r.arguments) > len(args) { + length = len(r.arguments) + } else { + length = len(args) + } + + for i := 0; i < length; i++ { + var arg interface{} + if len(r.arguments) > i { + arg = r.arguments[i] + } + if i < len(args) { argDef = args[i] } else if !argDef.Variadic {