also resize value when error

pull/314/head
Darien Raymond 2016-11-22 00:00:27 +01:00
parent 36cc6f5ef2
commit 85f9e39416
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 1 additions and 3 deletions

View File

@ -190,9 +190,7 @@ func (b *Buffer) FillFrom(reader io.Reader) (int, error) {
begin := b.Len()
b.Value = b.Value[:cap(b.Value)]
nBytes, err := reader.Read(b.Value[begin:])
if err == nil {
b.Value = b.Value[:begin+nBytes]
}
b.Value = b.Value[:begin+nBytes]
return nBytes, err
}