Apply suggestions from code review

Co-authored-by: Bond-009 <bond.009@outlook.com>
This commit is contained in:
Shadowghost 2023-05-21 13:52:43 +02:00 committed by GitHub
parent 6ddc449a89
commit a496da24e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,10 +79,7 @@ namespace MediaBrowser.Providers.TV
foreach (var season in sourceSeasonNames)
{
var seasonNumber = season.Key;
if (!targetSeasonNames.ContainsKey(seasonNumber))
{
targetItem.SeasonNames[seasonNumber] = season.Value;
}
targetSeasonNames.TryAdd(seasonNumber, season.Value);
}
}
@ -219,9 +216,9 @@ namespace MediaBrowser.Providers.TV
var existingSeason = seasons.FirstOrDefault(i => i.IndexNumber == seasonNumber);
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)