1
0
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:
Matt Bell
2015-01-06 12:25:15 -08:00
parent 97a3688429
commit 2816ed038c

View File

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