Skip to content

Commit

Permalink
Merge pull request #68 from mtrmac/read-0-nil
Browse files Browse the repository at this point in the history
Correctly handle Read returning (0, nil)
  • Loading branch information
vbatts authored Jul 22, 2023
2 parents 9982e47 + cd197d3 commit 5ef0dd8
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions tar/asm/disassemble.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,15 @@ func NewInputTarStream(r io.Reader, p storage.Packer, fp storage.FilePutter) (io
}
isEOF = true
}
if n == 0 {
break
}
_, err = p.AddEntry(storage.Entry{
Type: storage.SegmentType,
Payload: paddingChunk[:n],
})
if err != nil {
pW.CloseWithError(err)
return
if n != 0 {
_, err = p.AddEntry(storage.Entry{
Type: storage.SegmentType,
Payload: paddingChunk[:n],
})
if err != nil {
pW.CloseWithError(err)
return
}
}
if isEOF {
break
Expand Down

0 comments on commit 5ef0dd8

Please sign in to comment.