From db9c7f7c29df52a959f4965af5882a63bf786e4c Mon Sep 17 00:00:00 2001 From: Matt Bell <mappum@gmail.com> Date: Tue, 4 Nov 2014 00:22:31 -0800 Subject: [PATCH] commands: Fixed panic when trying to marshal without a command set in request --- commands/response.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/commands/response.go b/commands/response.go index ef3958bb5..c79734528 100644 --- a/commands/response.go +++ b/commands/response.go @@ -115,7 +115,10 @@ func (r *response) Marshal() ([]byte, error) { } encType := EncodingType(strings.ToLower(encStr)) - marshaller := r.req.Command().Marshallers[encType] + var marshaller Marshaller + if r.req.Command() != nil && r.req.Command().Marshallers != nil { + marshaller = r.req.Command().Marshallers[encType] + } if marshaller == nil { marshaller, ok = marshallers[encType] if !ok { -- GitLab