]> git.wh0rd.org - tt-rss.git/blobdiff - classes/feeditem/atom.php
fix previous to not crash if document first child is not a DOMElement or whatever
[tt-rss.git] / 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");
+                               }
+                       }
                }
        }
 }