Added missing check for the article image
authorAlexander Ebert <ebert@woltlab.com>
Thu, 28 Sep 2017 12:01:34 +0000 (14:01 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 28 Sep 2017 12:01:34 +0000 (14:01 +0200)
wcfsetup/install/files/lib/page/ArticlePage.class.php

index 573a6100ca6d2b5a75e9437087eb1c3f4cbd7af0..f2c6d1e14b382482c5bc937517eb933273a91a24 100644 (file)
@@ -111,8 +111,11 @@ class ArticlePage extends AbstractArticlePage {
                
                if ($this->articleContent->getTeaserImage()) {
                        MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->articleContent->getTeaserImage()->getLink(), true);
-                       MetaTagHandler::getInstance()->addTag('og:image:width', 'og:image:width', $this->articleContent->getImage()->width, true);
-                       MetaTagHandler::getInstance()->addTag('og:image:height', 'og:image:height', $this->articleContent->getImage()->height, true);
+                       
+                       if ($this->articleContent->getImage()) {
+                               MetaTagHandler::getInstance()->addTag('og:image:width', 'og:image:width', $this->articleContent->getImage()->width, true);
+                               MetaTagHandler::getInstance()->addTag('og:image:height', 'og:image:height', $this->articleContent->getImage()->height, true);
+                       }
                }
                
                // add tags as keywords