Yoast / Yoast-SEO-for-Magento2

Yoast SEO for Magento 2
Other
70 stars 28 forks source link

Only get logo src when logo block actually exists #88

Open peterjaap opened 6 years ago

peterjaap commented 6 years ago

We have a modified design for one of our clients and the logo block doesn't exist anymore. We now get this warning;

Fatal error: Uncaught Error: Call to a member function getLogoSrc() on boolean in /data/imaginerun/magento2/vendor/maxserv/magento-module-yoastseo/Block/Schema/Organization.php on line <i>44</i>

Due to this line; https://github.com/Yoast/Yoast-SEO-for-Magento2/blob/8c228d002f3b538438c211205f755638d955b5e9/Block/Schema/Organization.php#L24

It would be great to return null when the block doesn't exist like so

return $logoBlock ?  $logoBlock->getLogoSrc() : null;
choussamaster commented 5 years ago

Same problem here !