commands: Fixed panic when trying to marshal without a command set in request
Matt Bell committed
Nov 4, 2014 at 00:22 UTC
db9c7f7c29df52a959f4965af5882a63bf786e4c
1 file changed
+4
-1
commands/response.go
+4
-1
@@ -115,7 +115,10 @@ func (r *response) Marshal() ([]byte, error) {
115
}
116
encType := EncodingType(strings.ToLower(encStr))
117
118
- marshaller := r.req.Command().Marshallers[encType]
118
+ var marshaller Marshaller
119
+ if r.req.Command() != nil && r.req.Command().Marshallers != nil {
120
+ marshaller = r.req.Command().Marshallers[encType]
121
+ }
122
if marshaller == nil {
123
marshaller, ok = marshallers[encType]
124
if !ok {