From 8fb44a822d4fbfd42128587ca156d63ed00dc9a1 Mon Sep 17 00:00:00 2001 From: Ivan Andreev Date: Thu, 12 Sep 2019 23:07:25 +0300 Subject: [PATCH] mailru: fix rare nil pointer panic --- backend/mailru/mailru.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/mailru/mailru.go b/backend/mailru/mailru.go index e61206b01..d25223aff 100644 --- a/backend/mailru/mailru.go +++ b/backend/mailru/mailru.go @@ -217,11 +217,11 @@ var retryErrorCodes = []int{ // deserve to be retried. It returns the err as a convenience. // Retries password authorization (once) in a special case of access denied. func shouldRetry(res *http.Response, err error, f *Fs, opts *rest.Opts) (bool, error) { - if res.StatusCode == 403 && f.opt.Password != "" && !f.passFailed { + if res != nil && res.StatusCode == 403 && f.opt.Password != "" && !f.passFailed { reAuthErr := f.reAuthorize(opts, err) return reAuthErr == nil, err // return an original error } - if f.quirks.retry400 && res.StatusCode == 400 { + if res != nil && res.StatusCode == 400 && f.quirks.retry400 { return true, err } return fserrors.ShouldRetry(err) || fserrors.ShouldRetryHTTP(res, retryErrorCodes), err