From 4ec6110671815e57c1b124c1e473f096288ffc65 Mon Sep 17 00:00:00 2001 From: 6cUbi57z <3359745+6cUbi57z@users.noreply.github.com> Date: Sat, 27 Mar 2021 04:36:57 +0000 Subject: [PATCH] core: Fix exception when no result is returned from web request (#11371) for #11358 --- src/Jackett.Common/Indexers/BaseIndexer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Jackett.Common/Indexers/BaseIndexer.cs b/src/Jackett.Common/Indexers/BaseIndexer.cs index b25fbec01..cd7526f87 100644 --- a/src/Jackett.Common/Indexers/BaseIndexer.cs +++ b/src/Jackett.Common/Indexers/BaseIndexer.cs @@ -461,7 +461,14 @@ namespace Jackett.Common.Indexers retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt) / 4), onRetry: (exception, timeSpan, context) => { - logger.Warn($"Request to {DisplayName} failed with status {exception.Result.Status}. Retrying in {timeSpan.TotalSeconds}s... (Attempt {attemptNumber} of {NumberOfRetryAttempts})."); + if (exception.Result == null) + { + logger.Warn($"Request to {DisplayName} failed with exception '{exception.Exception.Message}'. Retrying in {timeSpan.TotalSeconds}s... (Attempt {attemptNumber} of {NumberOfRetryAttempts})."); + } + else + { + logger.Warn($"Request to {DisplayName} failed with status {exception.Result.Status}. Retrying in {timeSpan.TotalSeconds}s... (Attempt {attemptNumber} of {NumberOfRetryAttempts})."); + } attemptNumber++; }); return retryPolicy;