mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-01-02 23:04:23 +00:00
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:
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user