mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
fix crash
This commit is contained in:
@@ -300,7 +300,7 @@ func (c *Cache) LoadPiecesOnDisk() {
|
|||||||
limit := 5
|
limit := 5
|
||||||
|
|
||||||
for limit > 0 {
|
for limit > 0 {
|
||||||
if !c.pieces[pc].Complete {
|
if c.pieces != nil && c.pieces[pc] != nil && !c.pieces[pc].Complete {
|
||||||
if c.torrent.PieceState(pc).Priority == torrent.PiecePriorityNone {
|
if c.torrent.PieceState(pc).Priority == torrent.PiecePriorityNone {
|
||||||
c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityNormal)
|
c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityNormal)
|
||||||
}
|
}
|
||||||
@@ -314,13 +314,13 @@ func (c *Cache) LoadPiecesOnDisk() {
|
|||||||
pc := 0
|
pc := 0
|
||||||
end := c.pieceCount
|
end := c.pieceCount
|
||||||
for pc <= end {
|
for pc <= end {
|
||||||
if !c.pieces[pc].Complete {
|
if c.pieces != nil && c.pieces[pc] != nil && !c.pieces[pc].Complete {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
pc++
|
pc++
|
||||||
}
|
}
|
||||||
for pc <= end && limit > 0 {
|
for pc <= end && limit > 0 {
|
||||||
if !c.pieces[pc].Complete {
|
if c.pieces != nil && c.pieces[pc] != nil && !c.pieces[pc].Complete {
|
||||||
if c.torrent.PieceState(pc).Priority == torrent.PiecePriorityNone {
|
if c.torrent.PieceState(pc).Priority == torrent.PiecePriorityNone {
|
||||||
c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityNormal)
|
c.torrent.Piece(pc).SetPriority(torrent.PiecePriorityNormal)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user