Skip to content

Commit

Permalink
fix panic when write to a padding file
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle authored and cenkalti committed Nov 3, 2022
1 parent c0337cf commit f7e5da7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/filesection/section.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ func (p Piece) ReadAt(b []byte, off int64) (int, error) {
func (p Piece) Write(b []byte) (n int, err error) {
var m int
for _, sec := range p {
if sec.Padding {
continue
}
m, err = sec.File.WriteAt(b[:sec.Length], sec.Offset)
n += m
if err != nil {
Expand Down

0 comments on commit f7e5da7

Please sign in to comment.