Fix nullref in HTTP retry policy

This commit is contained in:
Tyrrrz 2023-01-25 20:51:07 +02:00
parent 56df93305e
commit 91ba79e6ec

View file

@ -39,8 +39,9 @@ public static class Http
8,
(i, result, _) =>
{
// If rate-limited, use retry-after header as the guide
if (result.Result.Headers.RetryAfter?.Delta is { } retryAfter)
// If rate-limited, use retry-after header as the guide.
// The response can be null here if an exception was thrown.
if (result.Result?.Headers.RetryAfter?.Delta is { } retryAfter)
{
// Add some buffer just in case
return retryAfter + TimeSpan.FromSeconds(1);