diff --git a/torrent.go b/torrent.go index fa034ebe6e..3be8ae8859 100644 --- a/torrent.go +++ b/torrent.go @@ -1054,6 +1054,11 @@ func (t *Torrent) numPieces(lock bool) pieceIndex { t.imu.RLock() defer t.imu.RUnlock() } + + if t.info == nil { + return 0 + } + return t.info.NumPieces() }