From fcc4ef2b958bac16ece1dcbc795e300eed6f978d Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Fri, 14 May 2021 15:19:49 +1000 Subject: [PATCH] Fix sqlite piece completion --- torrent.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 { -- 2.48.1