diff options
author | Andrew Dolgov <[email protected]> | 2014-01-12 08:53:30 +0400 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-01-12 08:53:30 +0400 |
commit | 2ab7ccb695fa690ee56100304b93d20e2c20debc (patch) | |
tree | b8552819e66a217fb6c87f6508a407d938472939 /classes/feeditem/atom.php | |
parent | de0d8d1088d8ab3505c9d775ec0dfb8bf1bea43d (diff) |
parser: fix failing on empty media:group tags
Diffstat (limited to 'classes/feeditem/atom.php')
-rw-r--r-- | classes/feeditem/atom.php | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/classes/feeditem/atom.php b/classes/feeditem/atom.php index 244fb1f84..74be03d80 100644 --- a/classes/feeditem/atom.php +++ b/classes/feeditem/atom.php @@ -160,19 +160,21 @@ class FeedItem_Atom extends FeedItem_Common { $content = $this->xpath->query("media:content", $enclosure)->item(0); - $enc->type = $content->getAttribute("type"); - $enc->link = $content->getAttribute("url"); - $enc->length = $content->getAttribute("length"); - - $desc = $this->xpath->query("media:description", $content)->item(0); - if ($desc) { - $enc->title = strip_tags($desc->nodeValue); - } else { - $desc = $this->xpath->query("media:description", $enclosure)->item(0); - if ($desc) $enc->title = strip_tags($desc->nodeValue); - } + if ($content) { + $enc->type = $content->getAttribute("type"); + $enc->link = $content->getAttribute("url"); + $enc->length = $content->getAttribute("length"); + + $desc = $this->xpath->query("media:description", $content)->item(0); + if ($desc) { + $enc->title = strip_tags($desc->nodeValue); + } else { + $desc = $this->xpath->query("media:description", $enclosure)->item(0); + if ($desc) $enc->title = strip_tags($desc->nodeValue); + } - array_push($encs, $enc); + array_push($encs, $enc); + } } $enclosures = $this->xpath->query("media:thumbnail", $this->elem); |