diff --git a/src/restic/debug/round_tripper_debug.go b/src/restic/debug/round_tripper_debug.go index 0ff9343ad..523d8438d 100644 --- a/src/restic/debug/round_tripper_debug.go +++ b/src/restic/debug/round_tripper_debug.go @@ -52,7 +52,9 @@ func (rd *eofDetectReader) Close() error { func (tr eofDetectRoundTripper) RoundTrip(req *http.Request) (res *http.Response, err error) { res, err = tr.RoundTripper.RoundTrip(req) - res.Body = &eofDetectReader{rd: res.Body} + if res != nil && res.Body != nil { + res.Body = &eofDetectReader{rd: res.Body} + } return res, err }