Fix server crash when receiving zero arg commands.

fix #246
This commit is contained in:
Josh Baker 2018-01-15 10:53:08 -07:00
parent 1f70cb4e75
commit 8a4ccc8e99
1 changed files with 21 additions and 19 deletions

View File

@ -223,6 +223,7 @@ moreData:
if !complete {
break
}
if len(args) > 0 {
if kind != kindHTTP {
msg.Command = strings.ToLower(string(args[0]))
for i := 0; i < len(args); i++ {
@ -244,6 +245,7 @@ moreData:
return nil, errInvalidHTTP
}
msgs = append(msgs, msg)
}
data = leftover
}
if len(data) > 0 {