From 412a2dcb6f27c1e6e9c5492656ab28ca01a4e699 Mon Sep 17 00:00:00 2001 From: ta264 Date: Wed, 19 Aug 2020 22:10:22 +0100 Subject: [PATCH] Fixed: Error adding some authors Fixes the case where the author wasn't the main contributor to their most popular book Fixes #42 Fixes #360 --- .../MetadataSource/Goodreads/GoodreadsProxy.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs b/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs index 8597474a2..3f6ab57b4 100644 --- a/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/Goodreads/GoodreadsProxy.cs @@ -113,11 +113,11 @@ namespace NzbDrone.Core.MetadataSource.Goodreads // we can only get a rating from the author list page... var listResource = GetAuthorBooksPageResource(foreignAuthorId, 10, 1); - var authorResource = listResource.List.First().Authors.First(a => a.Id.ToString() == foreignAuthorId); + var authorResource = listResource.List.SelectMany(x => x.Authors).FirstOrDefault(a => a.Id.ToString() == foreignAuthorId); author.Metadata.Value.Ratings = new Ratings { - Votes = authorResource.RatingsCount ?? 0, - Value = authorResource.AverageRating ?? 0 + Votes = authorResource?.RatingsCount ?? 0, + Value = authorResource?.AverageRating ?? 0 }; return author;