From 1eeb1bbf632678efa76d7eeb4ed5e9d44ecbc5b8 Mon Sep 17 00:00:00 2001 From: Qstick Date: Mon, 5 Nov 2018 20:41:29 -0500 Subject: [PATCH] Fixed: Handling of poorly formed items when parsing results from indexer Co-Authored-By: Mark McDowall --- src/NzbDrone.Core/Indexers/RssParser.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/RssParser.cs b/src/NzbDrone.Core/Indexers/RssParser.cs index 8e4b93d19..c8af9f437 100644 --- a/src/NzbDrone.Core/Indexers/RssParser.cs +++ b/src/NzbDrone.Core/Indexers/RssParser.cs @@ -259,12 +259,25 @@ namespace NzbDrone.Core.Indexers protected virtual RssEnclosure[] GetEnclosures(XElement item) { var enclosures = item.Elements("enclosure") - .Select(v => new RssEnclosure + .Select(v => { - Url = v.Attribute("url").Value, - Type = v.Attribute("type").Value, - Length = (long)v.Attribute("length") + try + { + return new RssEnclosure + { + Url = v.Attribute("url").Value, + Type = v.Attribute("type").Value, + Length = (long)v.Attribute("length") + }; + } + catch (Exception e) + { + _logger.Warn(e, "Failed to get enclosure for: {0}", item.Title()); + } + + return null; }) + .Where(v => v != null) .ToArray(); return enclosures;