From fd024ae1196b76abbaa97401bbf724f6c89444fb Mon Sep 17 00:00:00 2001 From: Andy Lo-A-Foe Date: Mon, 6 Feb 2023 12:56:31 +0100 Subject: [PATCH] Fix crashing bug --- internal/retry.go | 6 +++++- internal/version.go | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/internal/retry.go b/internal/retry.go index 84c84fef..fb5f7592 100644 --- a/internal/retry.go +++ b/internal/retry.go @@ -42,7 +42,11 @@ func TryHTTPCall(ctx context.Context, numberOfTries uint64, operation func() (*h } if shouldRetry { count = count + 1 - return fmt.Errorf("retry %d due to HTTP %d: %w", count, resp.StatusCode, err) + httpCode := 0 + if resp != nil { + httpCode = resp.StatusCode + } + return fmt.Errorf("retry %d due to HTTP %d: %w", count, httpCode, err) } return backoff.Permanent(fmt.Errorf("retry %d permanent: %w", count, err)) } diff --git a/internal/version.go b/internal/version.go index ddd7151b..c2c42cc3 100644 --- a/internal/version.go +++ b/internal/version.go @@ -1,5 +1,5 @@ package internal const ( - LibraryVersion = "0.78.5" + LibraryVersion = "0.78.6" )