forked from mirrors/tar-split
Fix panic in Next
readHeader should never return nil with a tr.err also nil. To correct this, ensure tr.err never gets reset to nil followed by a nil return.
This commit is contained in:
parent
6810cedb21
commit
e527e70d25
1 changed files with 2 additions and 1 deletions
|
@ -611,7 +611,8 @@ func (tr *Reader) readHeader() *Header {
|
||||||
if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil {
|
if _, tr.err = io.ReadFull(tr.r, header); tr.err != nil {
|
||||||
// because it could read some of the block, but reach EOF first
|
// because it could read some of the block, but reach EOF first
|
||||||
if tr.err == io.EOF && tr.RawAccounting {
|
if tr.err == io.EOF && tr.RawAccounting {
|
||||||
if _, tr.err = tr.rawBytes.Write(header); tr.err != nil {
|
if _, err := tr.rawBytes.Write(header); err != nil {
|
||||||
|
tr.err = err
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue