Apply suggestions from code review

Co-authored-by: Bond-009 <bond.009@outlook.com>
pull/8203/head
Shadowghost 2 years ago committed by GitHub
parent 6ddc449a89
commit a496da24e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -79,10 +79,7 @@ namespace MediaBrowser.Providers.TV
foreach (var season in sourceSeasonNames) foreach (var season in sourceSeasonNames)
{ {
var seasonNumber = season.Key; var seasonNumber = season.Key;
if (!targetSeasonNames.ContainsKey(seasonNumber)) targetSeasonNames.TryAdd(seasonNumber, season.Value);
{
targetItem.SeasonNames[seasonNumber] = season.Value;
}
} }
} }
@ -219,9 +216,9 @@ namespace MediaBrowser.Providers.TV
var existingSeason = seasons.FirstOrDefault(i => i.IndexNumber == seasonNumber); var existingSeason = seasons.FirstOrDefault(i => i.IndexNumber == seasonNumber);
string? seasonName = null; string? seasonName = null;
if (seasonNumber.HasValue && seasonNames.ContainsKey(seasonNumber.Value)) if (seasonNumber.HasValue && seasonNames.TryGetValue(seasonNumber.Value, out var tmp))
{ {
seasonName = seasonNames[seasonNumber.Value]; seasonName = tmp;
} }
if (existingSeason is null) if (existingSeason is null)

Loading…
Cancel
Save