From 1933e041a6afd759d18df7fe8ff5a49fdb12ba74 Mon Sep 17 00:00:00 2001 From: Mark Holt Date: Tue, 27 Aug 2024 10:43:30 +0100 Subject: [PATCH] check info nil --- torrent.go | 5 +++++ 1 file changed, 5 insertions(+) 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() }