From fd8d00ff0289d45d5654b071402ec051b3d32ff3 Mon Sep 17 00:00:00 2001 From: YouROK <8yourok8@mail.ru> Date: Thu, 18 Mar 2021 16:55:01 +0300 Subject: [PATCH] fix crash --- server/torr/storage/torrstor/reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/torr/storage/torrstor/reader.go b/server/torr/storage/torrstor/reader.go index c659b6b..a1e2701 100644 --- a/server/torr/storage/torrstor/reader.go +++ b/server/torr/storage/torrstor/reader.go @@ -90,7 +90,7 @@ func (r *Reader) Read(p []byte) (n int, err error) { } func (r *Reader) SetReadahead(length int64) { - if length > r.cache.capacity { + if r.cache != nil && length > r.cache.capacity { length = r.cache.capacity } r.Reader.SetReadahead(length)