title: PHP Fatal error Uncaught Error: Call to a member function getMetaTitle() on null in
body: <p>I'm getting the following error but it says it in Magento core. I was wondering how to debug this because I'm sure there is nothing wrong in Magentos core.</p>
  
  <p>Here is the error:</p>
  
  <pre><code>30-Apr-2018 18:05:23 UTC] PHP Fatal error:  Uncaught Error: Call to a member function getMetaTitle() on null in /home/example/public_html/app/code/core/Mage/Catalog/Block/Product/View.php:18
  Stack trace:
  #0 /home/example/public_html/app/code/core/Mage/Core/Block/Abstract.php(139): Mage_Catalog_Block_Product_View-&gt;_prepareLayout()
  #1 /home/example/public_html/app/code/core/Mage/Core/Model/Layout.php(322): Mage_Core_Block_Abstract-&gt;setLayout(Object(Inchoo_PHP7_Model_Layout))
  #2 /home/example/public_html/app/code/core/Mage/Core/Model/Layout.php(332): Mage_Core_Model_Layout-&gt;createBlock('review/product_...', 'product.info')
  #3 /home/example/public_html/app/code/core/Mage/Core/Model/Layout.php(147): Mage_Core_Model_Layout-&gt;addBlock('review/product_...', 'product.info')
  #4 /home/example/public_html/app/code/core/Mage/Core/Model/Layout.php(119): Mage_Core_Model_Layout-&gt;_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
  #5 /home/example/public_html/app/co in /home/example/public_html/app/code/core/Mage/Catalog/Block/Product/View.php on line 18
  </code></pre>
  
  <p>Here is <code>/home/angelsforeveryon/public_html/app/code/core/Mage/Catalog/Block/Product/View.php:18</code></p>
  
  <pre><code>protected function _prepareLayout()
  {
      $this-&gt;getLayout()-&gt;createBlock('catalog/breadcrumbs');
      $headBlock = $this-&gt;getLayout()-&gt;getBlock('head');
      if ($headBlock) {
          $product = $this-&gt;getProduct();
    line 18 here --&gt;     $title = $product-&gt;getMetaTitle();
          if ($title) {
              $headBlock-&gt;setTitle($title);
          }
          $keyword = $product-&gt;getMetaKeyword();
          $currentCategory = Mage::registry('current_category');
          if ($keyword) {
              $headBlock-&gt;setKeywords($keyword);
          } elseif ($currentCategory) {
              $headBlock-&gt;setKeywords($product-&gt;getName());
          }
          $description = $product-&gt;getMetaDescription();
          if ($description) {
              $headBlock-&gt;setDescription( ($description) );
          } else {
              $headBlock-&gt;setDescription(Mage::helper('core/string')-&gt;substr($product-&gt;getDescription(), 0, 255));
          }
          if ($this-&gt;helper('catalog/product')-&gt;canUseCanonicalTag()) {
              $params = array('_ignore_category' =&gt; true);
              $headBlock-&gt;addLinkRel('canonical', $product-&gt;getUrlModel()-&gt;getUrl($product, $params));
          }
      }
  
  return parent::_prepareLayout();
  </code></pre>
  
  <p>}</p>
  
  <p>Thanks              </p>