Skip to content

Commit

Permalink
commands: Fixed panic when trying to marshal without a command set in…
Browse files Browse the repository at this point in the history
… request
  • Loading branch information
mappum authored and jbenet committed Nov 4, 2014
1 parent bfcf531 commit feec8b1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion commands/response.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit feec8b1

Please sign in to comment.