Skip to content

Commit

Permalink
Guard statements to handle ugly feeds.
Browse files Browse the repository at this point in the history
  • Loading branch information
trayburn committed Jun 1, 2012
1 parent f09a534 commit 7081226
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Helpers/Extensions.cs
Expand Up @@ -37,6 +37,7 @@ public static string GetLink(this XElement item, string rel)

public static string GetSafeElementString(this XElement item, string elementName)
{
if (item == null) return String.Empty;
var value = item.Element(item.GetDefaultNamespace() + elementName);
if (value != null)
return value.Value;
Expand All @@ -46,6 +47,7 @@ public static string GetSafeElementString(this XElement item, string elementName

public static string GetSafeElementString(this XElement item, XName elementName)
{
if (item == null) return String.Empty;
var value = item.Element(elementName);
if (value != null)
return value.Value;
Expand Down

0 comments on commit 7081226

Please sign in to comment.