Browse Source

fix: avoid panic in `IsRateLimited()` function

Frédéric Guillot 1 year ago
parent
commit
5c4df786de
1 changed files with 1 additions and 1 deletions
  1. 1 1
      internal/reader/fetcher/response_handler.go

+ 1 - 1
internal/reader/fetcher/response_handler.go

@@ -70,7 +70,7 @@ func (r *ResponseHandler) ParseRetryDelay() int {
 }
 
 func (r *ResponseHandler) IsRateLimited() bool {
-	return r.httpResponse.StatusCode == http.StatusTooManyRequests
+	return r.httpResponse != nil && r.httpResponse.StatusCode == http.StatusTooManyRequests
 }
 
 func (r *ResponseHandler) IsModified(lastEtagValue, lastModifiedValue string) bool {