Fix special case with null byte input

This commit is contained in:
Alexander Neumann
2014-10-02 23:01:01 +02:00
parent b3a4bbc850
commit 83ea81d8c3
2 changed files with 23 additions and 9 deletions

View File

@@ -154,13 +154,15 @@ func (c *chunker) Next() (*Chunk, error) {
if err == io.EOF && !c.closed {
c.closed = true
// return current chunk
return &Chunk{
Start: c.start,
Length: c.count,
Cut: c.digest,
Data: c.data,
}, nil
// return current chunk, if any bytes have been processed
if c.count > 0 {
return &Chunk{
Start: c.start,
Length: c.count,
Cut: c.digest,
Data: c.data,
}, nil
}
}
if err != nil {