aboutsummaryrefslogtreecommitdiffstats
path: root/common/docserver/docserver.go
diff options
context:
space:
mode:
Diffstat (limited to 'common/docserver/docserver.go')
-rw-r--r--common/docserver/docserver.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/docserver/docserver.go b/common/docserver/docserver.go
index 8e943c186..5e076aa7e 100644
--- a/common/docserver/docserver.go
+++ b/common/docserver/docserver.go
@@ -55,7 +55,11 @@ func (self *DocServer) RegisterProtocols(schemes map[string]func(*DocServer) htt
func (self *DocServer) GetAuthContent(uri string, hash common.Hash) (content []byte, err error) {
// retrieve content
resp, err := self.Client().Get(uri)
- defer resp.Body.Close()
+ defer func() {
+ if resp != nil {
+ resp.Body.Close()
+ }
+ }()
if err != nil {
return
}