From b6d43273cfe84a22df6b8d6959b6822f53fc782f Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Thu, 19 Jan 2012 23:08:05 -0800 Subject: [PATCH] Fixed an issue where an unparsable item could break the parser. --- NzbDrone.Core.Test/ParserTest.cs | 14 ++++++++++++++ NzbDrone.Core/Parser.cs | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/NzbDrone.Core.Test/ParserTest.cs b/NzbDrone.Core.Test/ParserTest.cs index 5e3d793bc..c628725e4 100644 --- a/NzbDrone.Core.Test/ParserTest.cs +++ b/NzbDrone.Core.Test/ParserTest.cs @@ -90,6 +90,20 @@ namespace NzbDrone.Core.Test ExceptionVerification.IgnoreWarns(); } + [Test] + public void unparsable_path() + { + Parser.ParsePath("C:\\").Should().BeNull(); + ExceptionVerification.IgnoreWarns(); + } + + [Test] + public void unparsable_title() + { + Parser.ParseTitle("SOMETHING").Should().BeNull(); + ExceptionVerification.IgnoreWarns(); + } + [TestCase("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.X-viD.AC3.-HELLYWOOD", QualityTypes.DVD)] [TestCase("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.DVD)] diff --git a/NzbDrone.Core/Parser.cs b/NzbDrone.Core/Parser.cs index 2442d553f..f4c9b8ece 100644 --- a/NzbDrone.Core/Parser.cs +++ b/NzbDrone.Core/Parser.cs @@ -77,7 +77,10 @@ namespace NzbDrone.Core result = ParseTitle(fileInfo.FullName); } - result.OriginalString = path; + if (result != null) + { + result.OriginalString = path; + } return result; }