From: Matt Joiner Date: Sun, 16 May 2021 23:08:39 +0000 (+1000) Subject: Fix in decPieceAvailability when we don't have torrent info X-Git-Tag: v1.29.0~31^2~23 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=42bf6b58a6caa7225fcedc2c4799d5f945b344c2;p=btrtrc.git Fix in decPieceAvailability when we don't have torrent info Happens when we close a Peer before getting Torrent info. --- diff --git a/torrent.go b/torrent.go index 70e4ecd8..da71ba93 100644 --- a/torrent.go +++ b/torrent.go @@ -158,6 +158,9 @@ func (t *Torrent) pieceAvailabilityFromPeers(i pieceIndex) (count int) { } func (t *Torrent) decPieceAvailability(i pieceIndex) { + if !t.haveInfo() { + return + } p := t.piece(i) if p.availability <= 0 { panic(p.availability)