From 68e1a0bc4d64cc7def489e231ae6304d34f7049d Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Fri, 27 Jan 2012 16:15:09 -0800 Subject: [PATCH] Fixed: Fixed issue where an unknown episode/item in the queue would crash CheckQueue. --- NzbDrone.Core.Test/Files/Queue.txt | 21 +++++++++++++++++++ .../SabProviderTests/QueueFixture.cs | 8 ++++++- NzbDrone.Core/Providers/SabProvider.cs | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/NzbDrone.Core.Test/Files/Queue.txt b/NzbDrone.Core.Test/Files/Queue.txt index 5e581cd1f..13edf093c 100644 --- a/NzbDrone.Core.Test/Files/Queue.txt +++ b/NzbDrone.Core.Test/Files/Queue.txt @@ -92,6 +92,27 @@ "unpackopts":"3", "verbosity":"" }, + { + "avg_age":"580d", + "cat":"tv", + "eta":"01:45 PM Mon 23 Jan", + "filename":"Invalid Item", + "index":1, + "mb":"419.23", + "mbleft":"419.23", + "missing":0, + "msgid":5657628, + "nzo_id":"SABnzbd_nzo_dgrzts", + "percentage":"0", + "priority":"Normal", + "script":"None", + "size":"419 MB", + "sizeleft":"419 MB", + "status":"Queued", + "timeleft":"86:01:55", + "unpackopts":"3", + "verbosity":"" + }, { "status":"Paused", "index":1, diff --git a/NzbDrone.Core.Test/ProviderTests/SabProviderTests/QueueFixture.cs b/NzbDrone.Core.Test/ProviderTests/SabProviderTests/QueueFixture.cs index 3e046b84a..29af676b7 100644 --- a/NzbDrone.Core.Test/ProviderTests/SabProviderTests/QueueFixture.cs +++ b/NzbDrone.Core.Test/ProviderTests/SabProviderTests/QueueFixture.cs @@ -94,7 +94,7 @@ namespace NzbDrone.Core.Test.ProviderTests.SabProviderTests var result = Mocker.Resolve().GetQueue(); - result.Should().HaveCount(3); + result.Should().HaveCount(4); } [Test] @@ -209,6 +209,12 @@ namespace NzbDrone.Core.Test.ProviderTests.SabProviderTests result.Should().BeFalse(); } + [TearDown] + public void TearDown() + { + ExceptionVerification.IgnoreWarns(); + } + } } \ No newline at end of file diff --git a/NzbDrone.Core/Providers/SabProvider.cs b/NzbDrone.Core/Providers/SabProvider.cs index db6e93cec..15cdc890c 100644 --- a/NzbDrone.Core/Providers/SabProvider.cs +++ b/NzbDrone.Core/Providers/SabProvider.cs @@ -75,7 +75,7 @@ namespace NzbDrone.Core.Providers public virtual bool IsInQueue(EpisodeParseResult newParseResult) { - var queue = GetQueue(); + var queue = GetQueue().Where(c => c.ParseResult != null); return queue.Any(sabQueueItem => String.Equals(sabQueueItem.ParseResult.CleanTitle, newParseResult.Series.CleanTitle, StringComparison.InvariantCultureIgnoreCase) && sabQueueItem.ParseResult.EpisodeNumbers.Any(e => newParseResult.EpisodeNumbers.Contains(e)) &&