deal with empty input in ReadAllToBytes.

pull/1132/head
Darien Raymond 2018-05-28 15:38:29 +02:00
parent d6513ee4ec
commit e3508fffc6
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,9 @@ func ReadAllToBytes(reader io.Reader) ([]byte, error) {
if err != nil {
return nil, err
}
if mb.Len() == 0 {
return nil, nil
}
b := make([]byte, mb.Len())
common.Must2(mb.Read(b))
mb.Release()