Prevent NullRef in GetChangedAuthors when metadata is down

pull/2479/head
Bogdan 1 year ago
parent a97af657be
commit bdb2f14936

@ -8,6 +8,7 @@ using System.Threading;
using LazyCache; using LazyCache;
using LazyCache.Providers; using LazyCache.Providers;
using Microsoft.Extensions.Caching.Memory; using Microsoft.Extensions.Caching.Memory;
using Newtonsoft.Json;
using NLog; using NLog;
using NzbDrone.Common.Cache; using NzbDrone.Common.Cache;
using NzbDrone.Common.Extensions; using NzbDrone.Common.Extensions;
@ -18,6 +19,7 @@ using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Http; using NzbDrone.Core.Http;
using NzbDrone.Core.MediaCover; using NzbDrone.Core.MediaCover;
using NzbDrone.Core.MetadataSource.Goodreads; using NzbDrone.Core.MetadataSource.Goodreads;
using JsonSerializer = System.Text.Json.JsonSerializer;
namespace NzbDrone.Core.MetadataSource.BookInfo namespace NzbDrone.Core.MetadataSource.BookInfo
{ {
@ -78,7 +80,7 @@ namespace NzbDrone.Core.MetadataSource.BookInfo
var httpResponse = _httpClient.Get<RecentUpdatesResource>(httpRequest); var httpResponse = _httpClient.Get<RecentUpdatesResource>(httpRequest);
if (httpResponse.Resource.Limited) if (httpResponse.Resource == null || httpResponse.Resource.Limited)
{ {
return null; return null;
} }
@ -469,17 +471,17 @@ namespace NzbDrone.Core.MetadataSource.BookInfo
private List<Book> MapSearchResult(List<int> ids) private List<Book> MapSearchResult(List<int> ids)
{ {
HttpRequest httpRequest;
HttpResponse<BulkBookResource> httpResponse; HttpResponse<BulkBookResource> httpResponse;
while (true) while (true)
{ {
httpRequest = _requestBuilder.GetRequestBuilder().Create() var httpRequest = _requestBuilder.GetRequestBuilder().Create()
.SetSegment("route", $"book/bulk") .SetSegment("route", "book/bulk")
.SetHeader("Content-Type", "application/json") .SetHeader("Content-Type", "application/json")
.Build(); .Build();
httpRequest.SetContent(ids.ToJson()); httpRequest.SetContent(ids.ToJson());
httpRequest.ContentSummary = ids.ToJson(Formatting.None);
httpRequest.AllowAutoRedirect = true; httpRequest.AllowAutoRedirect = true;
httpRequest.SuppressHttpError = true; httpRequest.SuppressHttpError = true;

Loading…
Cancel
Save