mirror of
https://github.com/lidarr/Lidarr
synced 2025-03-12 06:53:24 +00:00
Fixed: Null reference error when import list adds new album to existing artist
(cherry picked from commit 5e3045db86748d0ab407a6785007cb6bbd4f46a6) (cherry picked from commit 21d867c35c3805d82b95b0ecbdacb3ab4fec49dd)
This commit is contained in:
parent
93bb1d44b8
commit
a059b584db
2 changed files with 6 additions and 3 deletions
|
@ -89,14 +89,14 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|||
{
|
||||
Mocker.GetMock<IArtistService>()
|
||||
.Setup(v => v.FindById(_importListReports.First().ArtistMusicBrainzId))
|
||||
.Returns(new Artist { ForeignArtistId = _importListReports.First().ArtistMusicBrainzId });
|
||||
.Returns(new Artist { Id = 1, ForeignArtistId = _importListReports.First().ArtistMusicBrainzId });
|
||||
}
|
||||
|
||||
private void WithExistingAlbum()
|
||||
{
|
||||
Mocker.GetMock<IAlbumService>()
|
||||
.Setup(v => v.FindById(_importListReports.First().AlbumMusicBrainzId))
|
||||
.Returns(new Album { ForeignAlbumId = _importListReports.First().AlbumMusicBrainzId });
|
||||
.Returns(new Album { Id = 1, ForeignAlbumId = _importListReports.First().AlbumMusicBrainzId });
|
||||
}
|
||||
|
||||
private void WithExcludedArtist()
|
||||
|
@ -215,6 +215,7 @@ namespace NzbDrone.Core.Test.ImportListTests
|
|||
public void should_add_if_existing_artist_but_new_album()
|
||||
{
|
||||
WithAlbumId();
|
||||
WithArtistId();
|
||||
WithExistingArtist();
|
||||
|
||||
Subject.Execute(new ImportListSyncCommand());
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Extensions;
|
||||
|
@ -243,8 +244,9 @@ namespace NzbDrone.Core.ImportLists
|
|||
}
|
||||
};
|
||||
|
||||
if (importList.ShouldMonitor == ImportListMonitorType.SpecificAlbum)
|
||||
if (importList.ShouldMonitor == ImportListMonitorType.SpecificAlbum && toAddArtist.AddOptions != null)
|
||||
{
|
||||
Debug.Assert(toAddArtist.Id == 0, "new artist added but ID is not 0");
|
||||
toAddArtist.AddOptions.AlbumsToMonitor.Add(toAdd.ForeignAlbumId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue