From 15425a45a3dfa8404f0ea136aaa8eacdd00137e9 Mon Sep 17 00:00:00 2001 From: Tom Andrews Date: Tue, 12 Mar 2019 22:37:59 +0000 Subject: [PATCH] Fixed: Null reference exception in CompletedDownloadService Fixes Sentry LIDARR-1GW --- .../Download/CompletedDownloadServiceFixture.cs | 10 ++++++++++ src/NzbDrone.Core/Download/CompletedDownloadService.cs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs index 9cb6663656..acb65a85ca 100644 --- a/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs +++ b/src/NzbDrone.Core.Test/Download/CompletedDownloadServiceFixture.cs @@ -176,6 +176,16 @@ public void should_not_process_if_output_path_is_empty() AssertNoAttemptedImport(); } + [Test] + public void should_not_throw_if_remotealbum_is_null() + { + _trackedDownload.RemoteAlbum = null; + + Subject.Process(_trackedDownload); + + AssertNoAttemptedImport(); + } + [Test] public void should_mark_as_imported_if_all_tracks_were_imported() { diff --git a/src/NzbDrone.Core/Download/CompletedDownloadService.cs b/src/NzbDrone.Core/Download/CompletedDownloadService.cs index 19c39da7ac..54ce286511 100644 --- a/src/NzbDrone.Core/Download/CompletedDownloadService.cs +++ b/src/NzbDrone.Core/Download/CompletedDownloadService.cs @@ -80,7 +80,7 @@ public void Process(TrackedDownload trackedDownload, bool ignoreWarnings = false return; } - var artist = trackedDownload.RemoteAlbum.Artist; + var artist = trackedDownload.RemoteAlbum?.Artist; if (artist == null) {