]> git.wh0rd.org - tt-rss.git/commitdiff
fix previous to not crash if document first child is not a DOMElement or whatever
authorAndrew Dolgov <noreply@fakecake.org>
Sun, 12 Aug 2018 16:27:04 +0000 (19:27 +0300)
committerAndrew Dolgov <noreply@fakecake.org>
Sun, 12 Aug 2018 16:27:04 +0000 (19:27 +0300)
classes/feeditem/atom.php

index ee55917577e77234c00c580fdb4437a75e8cbb37..8c3e0f8a748b029b8c81b9df86cce89269efabdd 100644 (file)
@@ -205,7 +205,11 @@ class FeedItem_Atom extends FeedItem_Common {
                        return $lang;
                } else {
                        // Fall back to the language declared on the feed, if any.
-                       return $this->doc->firstChild->getAttributeNS(self::NS_XML, "lang");
+                       foreach ($this->doc->childNodes as $child) {
+                               if (method_exists($child, "getAttributeNS")) {
+                                       return $child->getAttributeNS(self::NS_XML, "lang");
+                               }
+                       }
                }
        }
 }