mirror of https://github.com/lidarr/Lidarr
Don't try to match a null codec name (#784)
* Don't try to match a null codec name * Add test
This commit is contained in:
parent
1955cd9f73
commit
541841d7b7
|
@ -284,6 +284,12 @@ namespace NzbDrone.Core.Test.ParserTests
|
|||
QualityParser.ParseQuality(title, null, 0).QualityDetectionSource.Should().Be(QualityDetectionSource.Extension);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_parse_null_quality_description_as_unknown()
|
||||
{
|
||||
QualityParser.ParseCodec(null, null).Should().Be(Codec.Unknown);
|
||||
}
|
||||
|
||||
private void ParseAndVerifyQuality(string name, string desc, int bitrate, Quality quality, int sampleSize = 0)
|
||||
{
|
||||
var result = QualityParser.ParseQuality(name, desc, bitrate, sampleSize);
|
||||
|
|
|
@ -154,6 +154,11 @@ namespace NzbDrone.Core.Parser
|
|||
|
||||
public static Codec ParseCodec(string name, string origName)
|
||||
{
|
||||
if (name.IsNullOrWhiteSpace())
|
||||
{
|
||||
return Codec.Unknown;
|
||||
}
|
||||
|
||||
var match = CodecRegex.Match(name);
|
||||
|
||||
if (!match.Success) { return Codec.Unknown; }
|
||||
|
|
Loading…
Reference in New Issue