From: Matt Joiner Date: Fri, 14 May 2021 05:19:49 +0000 (+1000) Subject: Fix sqlite piece completion X-Git-Tag: v1.29.0~31^2~24 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=fcc4ef2b958bac16ece1dcbc795e300eed6f978d;p=btrtrc.git Fix sqlite piece completion --- diff --git a/torrent.go b/torrent.go index 05598b3c..70e4ecd8 100644 --- a/torrent.go +++ b/torrent.go @@ -166,8 +166,11 @@ func (t *Torrent) decPieceAvailability(i pieceIndex) { } func (t *Torrent) incPieceAvailability(i pieceIndex) { - p := t.piece(i) - p.availability++ + // If we don't the info, this should be reconciled when we do. + if t.haveInfo() { + p := t.piece(i) + p.availability++ + } } func (t *Torrent) numConns() int {