]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Fix sqlite piece completion
authorMatt Joiner <anacrolix@gmail.com>
Fri, 14 May 2021 05:19:49 +0000 (15:19 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 7 Jun 2021 03:01:39 +0000 (13:01 +1000)
torrent.go

index 05598b3c151029e7075c0d0b5623f54f4521214a..70e4ecd8d81addf1e86d68d8d4185b70ecda91ef 100644 (file)
@@ -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 {