mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 13:00:37 +08:00
commands: Fixed panic when trying to marshal without a command set in request
This commit is contained in:

committed by
Juan Batiz-Benet

parent
df6c700426
commit
db9c7f7c29
@ -115,7 +115,10 @@ func (r *response) Marshal() ([]byte, error) {
|
|||||||
}
|
}
|
||||||
encType := EncodingType(strings.ToLower(encStr))
|
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 {
|
if marshaller == nil {
|
||||||
marshaller, ok = marshallers[encType]
|
marshaller, ok = marshallers[encType]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
Reference in New Issue
Block a user