From 100fd95dd99ca38e5a32711580b9a07bd2b1925d Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 3 Jan 2022 20:20:16 -0600 Subject: [PATCH] Fixed: Fix bad ratings objects in Migration 206 --- .../Migration/206_multiple_ratings_support.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/Datastore/Migration/206_multiple_ratings_support.cs b/src/NzbDrone.Core/Datastore/Migration/206_multiple_ratings_support.cs index 717aa3722..8c2c41ef6 100644 --- a/src/NzbDrone.Core/Datastore/Migration/206_multiple_ratings_support.cs +++ b/src/NzbDrone.Core/Datastore/Migration/206_multiple_ratings_support.cs @@ -18,7 +18,7 @@ namespace NzbDrone.Core.Datastore.Migration _serializerSettings = new JsonSerializerOptions { AllowTrailingCommas = true, - DefaultIgnoreCondition = JsonIgnoreCondition.Never, + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, PropertyNameCaseInsensitive = true, DictionaryKeyPolicy = JsonNamingPolicy.CamelCase, PropertyNamingPolicy = JsonNamingPolicy.CamelCase, @@ -43,18 +43,24 @@ namespace NzbDrone.Core.Datastore.Migration foreach (var row in rows) { - var oldRatings = JsonSerializer.Deserialize(row.Ratings, _serializerSettings); - var newRatings = new Ratings206 { Tmdb = new RatingChild206 { - Votes = oldRatings.Votes, - Value = oldRatings.Value, + Votes = 0, + Value = 0, Type = RatingType206.User } }; + if (row.Ratings != null) + { + var oldRatings = JsonSerializer.Deserialize(row.Ratings, _serializerSettings); + + newRatings.Tmdb.Votes = oldRatings.Votes; + newRatings.Tmdb.Value = oldRatings.Value; + } + corrected.Add(new Movie206 { Id = row.Id,