1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-10-30 15:32:31 +01:00

Guard against null reference exception when parsing newznab capabilities

Closes #2054
This commit is contained in:
Mark McDowall 2017-07-26 07:17:47 -07:00
parent 5efff4d481
commit 4b9f2e0ff7
No known key found for this signature in database
GPG Key ID: D4CEFA9A718052E0

View File

@ -85,7 +85,19 @@ namespace NzbDrone.Core.Indexers.Newznab
{
var capabilities = new NewznabCapabilities();
var xmlRoot = XDocument.Parse(response.Content).Element("caps");
var xDoc = XDocument.Parse(response.Content);
if (xDoc == null)
{
throw new XmlException("Invalid XML");
}
var xmlRoot = xDoc.Element("caps");
if (xmlRoot == null)
{
throw new XmlException("Unexpected XML");
}
var xmlLimits = xmlRoot.Element("limits");
if (xmlLimits != null)