mirror of https://github.com/lidarr/Lidarr
Fixed: Don't die when the artist is missing for leftover albums
This commit is contained in:
parent
f63abedbae
commit
897357ff31
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue