Fixed: Don't die when the artist is missing for leftover albums

This commit is contained in:
Bogdan 2023-10-24 22:43:47 +03:00
parent f63abedbae
commit 897357ff31
1 changed files with 5 additions and 7 deletions

View File

@ -73,15 +73,13 @@ namespace Lidarr.Api.V1.Albums
foreach (var album in albums)
{
album.Artist = artists[album.ArtistMetadataId];
if (releases.TryGetValue(album.Id, out var albumReleases))
if (!artists.TryGetValue(album.ArtistMetadataId, out var albumArtist))
{
album.AlbumReleases = albumReleases;
}
else
{
album.AlbumReleases = new List<AlbumRelease>();
continue;
}
album.Artist = albumArtist;
album.AlbumReleases = releases.TryGetValue(album.Id, out var albumReleases) ? albumReleases : new List<AlbumRelease>();
}
return MapToResource(albums, false);