X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=torrent-piece-request-order.go;h=10623da0b5d83594c396a14a11a2599123b44151;hb=e6a38b1cd194c7c689546f850ef48744ff0318c1;hp=17206679e86919c8fa79a77326e927d8e9a7496f;hpb=56c8b396f50fd2603fcefed128ba72e13e2961ef;p=btrtrc.git 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{} {