]> git.wh0rd.org Git - tt-rss.git/commitdiff
parser: fix failing on empty media:group tags
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 12 Jan 2014 04:53:30 +0000 (08:53 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Sun, 12 Jan 2014 04:53:30 +0000 (08:53 +0400)
classes/feeditem/atom.php
classes/feeditem/rss.php

index 244fb1f84671ac61de286ea06ea8441f2e0b4b07..74be03d8031e4957d32ffe82b37d8f811be1126d 100644 (file)
@@ -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);
index 7d445a6c348d1f79aac6d8ca9bced1076933a12f..28f4a388d648a8bd43a7a145c9438c939eddb23a 100644 (file)
@@ -140,19 +140,21 @@ class FeedItem_RSS 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);