diff options
Diffstat (limited to 'modules/git/tree_entry.go')
-rw-r--r-- | modules/git/tree_entry.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/modules/git/tree_entry.go b/modules/git/tree_entry.go index 498767a63e..3644d00f36 100644 --- a/modules/git/tree_entry.go +++ b/modules/git/tree_entry.go @@ -34,12 +34,19 @@ func (te *TreeEntry) FollowLink() (*TreeEntry, error) { if err != nil { return nil, err } - defer r.Close() + closed := false + defer func() { + if !closed { + _ = r.Close() + } + }() buf := make([]byte, te.Size()) _, err = io.ReadFull(r, buf) if err != nil { return nil, err } + _ = r.Close() + closed = true lnk := string(buf) t := te.ptree |