From 0ade546b76204a2343da81554bac0aebb38989ae Mon Sep 17 00:00:00 2001 From: William Floyd Date: Fri, 7 Feb 2025 02:24:23 +0530 Subject: [PATCH] fix: handle empty response request. --- handlers.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/handlers.go b/handlers.go index ed91639..e034bce 100644 --- a/handlers.go +++ b/handlers.go @@ -321,6 +321,10 @@ func (c *Config) HandlerTorrentsMaindata(r *http.Request) (*http.Response, error callback := func(c *Config, resp *http.Response) error { + if resp.Request == nil { + return errors.New("empty request attached to response") + } + instance := resp.Request.Context().Value(qbittorrent.ContextKeyInstance).(*qbittorrent.Instance) if instance == nil { return errors.New("empty instance")