From bd660fc39a1a86c5541e609010324bf1426543ef Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Tue, 27 Apr 2021 11:18:49 +0300 Subject: [PATCH] fix crash on nil cache --- server/torr/torrent.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/server/torr/torrent.go b/server/torr/torrent.go index 0705037..11ac52a 100644 --- a/server/torr/torrent.go +++ b/server/torr/torrent.go @@ -172,7 +172,9 @@ func (t *Torrent) progressEvent() { t.BytesReadUsefulData = st.BytesRead.Int64() t.BytesWrittenData = st.BytesWritten.Int64() - t.PreloadedBytes = t.cache.GetState().Filled + if t.cache != nil { + t.PreloadedBytes = t.cache.GetState().Filled + } } else { t.DownloadSpeed = 0 t.UploadSpeed = 0