Skip to content

Commit

Permalink
Avoid crash if p.have.n is 0
Browse files Browse the repository at this point in the history
Work around issue #54.
  • Loading branch information
jackpal committed Jul 27, 2014
1 parent 848bdae commit 735283a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion torrent/torrent.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ func (t *TorrentSession) RecordBlock(p *peerState, piece, begin, length uint32)
}
for _, p := range t.peers {
if p.have != nil {
if p.have.IsSet(int(piece)) {
if int(piece) < p.have.n && p.have.IsSet(int(piece)) {
// We don't do anything special. We rely on the caller
// to decide if this peer is still interesting.
} else {
Expand Down

0 comments on commit 735283a

Please sign in to comment.