mirror of
https://github.com/Sonarr/Sonarr
synced 2024-12-27 10:17:47 +00:00
Fixed an issue where GetEpisodesByParseResult would throw object reference when episode list was null
This commit is contained in:
parent
ea05635fd3
commit
ae1a32b874
2 changed files with 30 additions and 1 deletions
|
@ -234,5 +234,31 @@ namespace NzbDrone.Core.Test
|
||||||
db.Fetch<Episode>().Should().HaveCount(2);
|
db.Fetch<Episode>().Should().HaveCount(2);
|
||||||
ep.First().Ignored.Should().BeFalse();
|
ep.First().Ignored.Should().BeFalse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Description("GetEpisodeParseResult should return empty list if episode list is null")]
|
||||||
|
public void GetEpisodeParseResult_should_return_empty_list_if_episode_list_is_null()
|
||||||
|
{
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
//Act
|
||||||
|
var episodes = mocker.Resolve<EpisodeProvider>().GetEpisodesByParseResult(new EpisodeParseResult());
|
||||||
|
//Assert
|
||||||
|
episodes.Should().NotBeNull();
|
||||||
|
episodes.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Description("GetEpisodeParseResult should return empty list if episode list is empty")]
|
||||||
|
public void GetEpisodeParseResult_should_return_empty_list_if_episode_list_is_empty()
|
||||||
|
{
|
||||||
|
var mocker = new AutoMoqer();
|
||||||
|
//Act
|
||||||
|
var episodes = mocker.Resolve<EpisodeProvider>().GetEpisodesByParseResult(new EpisodeParseResult{EpisodeNumbers = new List<int>()});
|
||||||
|
//Assert
|
||||||
|
episodes.Should().NotBeNull();
|
||||||
|
episodes.Should().BeEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -125,6 +125,9 @@ namespace NzbDrone.Core.Providers
|
||||||
{
|
{
|
||||||
var result = new List<Episode>();
|
var result = new List<Episode>();
|
||||||
|
|
||||||
|
if (parseResult.EpisodeNumbers == null)
|
||||||
|
return result;
|
||||||
|
|
||||||
foreach (var episodeNumber in parseResult.EpisodeNumbers)
|
foreach (var episodeNumber in parseResult.EpisodeNumbers)
|
||||||
{
|
{
|
||||||
var episodeInfo = GetEpisode(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber);
|
var episodeInfo = GetEpisode(parseResult.Series.SeriesId, parseResult.SeasonNumber, episodeNumber);
|
||||||
|
@ -159,7 +162,7 @@ namespace NzbDrone.Core.Providers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Logger.Debug("Unable to file {0}-S{1:00}E{2:00}", parseResult.Series.Title, parseResult.SeasonNumber, episodeNumber);
|
Logger.Debug("Unable to find {0}-S{1:00}E{2:00}", parseResult.Series.Title, parseResult.SeasonNumber, episodeNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue