From: Pavel Tatarskiy Date: Fri, 19 May 2023 04:23:34 +0000 (+0300) Subject: fixes anacrolix/torrent#795 (#807) X-Git-Tag: v1.51.1~2 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=e6a38b1cd194c7c689546f850ef48744ff0318c1;p=btrtrc.git fixes anacrolix/torrent#795 (#807) --- diff --git a/torrent-piece-request-order.go b/torrent-piece-request-order.go index 17206679..10623da0 100644 --- a/torrent-piece-request-order.go +++ b/torrent-piece-request-order.go @@ -8,9 +8,11 @@ func (t *Torrent) updatePieceRequestOrder(pieceIndex int) { if t.storage == nil { return } - t.cl.pieceRequestOrder[t.clientPieceRequestOrderKey()].Update( - t.pieceRequestOrderKey(pieceIndex), - t.requestStrategyPieceOrderState(pieceIndex)) + if ro, ok := t.cl.pieceRequestOrder[t.clientPieceRequestOrderKey()]; ok { + ro.Update( + t.pieceRequestOrderKey(pieceIndex), + t.requestStrategyPieceOrderState(pieceIndex)) + } } func (t *Torrent) clientPieceRequestOrderKey() interface{} {