views:

22

answers:

0
List<string> hrefTags = new List<string>();
foreach (HtmlNode link in htmldocObject.DocumentNode.SelectNodes("//a[@href]")) 
{ 
    HtmlAttribute att = link.Attributes["href"];
    hrefTags.Add(att.Value + "|" + link.InnerText);
}

return hrefTag;

What happens is when i pull the links off a page every now and then when pulling the links i run into an exception :

NullReferenceException was unhandled. Object reference not set to an instance of an object.

Anybody familiar with this exception in HtmlAgilityPack?