From 6e4bbb9e42d3a406b2e404ebe1897e26bdb35c54 Mon Sep 17 00:00:00 2001 From: Mrs4s Date: Fri, 15 Oct 2021 11:34:55 +0800 Subject: [PATCH] fix: nil pointer deference on HttpGetBytes. --- utils/http.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/http.go b/utils/http.go index fb0735be..ea594e84 100644 --- a/utils/http.go +++ b/utils/http.go @@ -20,10 +20,10 @@ var client = &http.Client{ // HttpGetBytes 带 cookie 的 GET 请求 func HttpGetBytes(url, cookie string) ([]byte, error) { body, err := HTTPGetReadCloser(url, cookie) - defer func() { _ = body.Close() }() if err != nil { return nil, err } + defer func() { _ = body.Close() }() return io.ReadAll(body) }