Don't try to match a null codec name (#784)

* Don't try to match a null codec name

* Add test
pull/786/head
ta264 6 years ago committed by GitHub
parent 1955cd9f73
commit 541841d7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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…
Cancel
Save