mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-02 03:28:25 +08:00
commands: Fixed panic when marshalers gave nil output
This commit is contained in:
@ -160,7 +160,14 @@ func (r *response) Marshal() (io.Reader, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return marshaller(r)
|
||||
output, err := marshaller(r)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if output == nil {
|
||||
return bytes.NewReader([]byte{}), nil
|
||||
}
|
||||
return output, nil
|
||||
}
|
||||
|
||||
// Reader returns an `io.Reader` representing marshalled output of this Response
|
||||
|
Reference in New Issue
Block a user