mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07: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:
parent
1955cd9f73
commit
541841d7b7
2 changed files with 11 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue