1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-07-04 13:27:14 +08:00

commands: Fixed panic when trying to marshal without a command set in request

This commit is contained in:
Matt Bell
2014-11-04 00:22:31 -08:00
committed by Juan Batiz-Benet
parent df6c700426
commit db9c7f7c29

View File

@ -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 {