Fixing getMetaTitle() Error on Product Without Category URL in Magento 1.7

magento-1.7productproducts-management

When I disable a product and access the product by full category URL I am sent to a 404 page. Good.

When I attempt to access the disabled product by http://domain.com/disabled-product.html I get

Fatal error: Call to a member function getMetaTitle() on a non-object in /app/code/core/Mage/Catalog/Block/Product/View.php on line 57

Could it be that an extension is attempting to load prior to the redirect?

EDIT: Lines 50-59

protected function _prepareLayout()
{
    $this->getLayout()->createBlock('catalog/breadcrumbs');
    $headBlock = $this->getLayout()->getBlock('head');
    if ($headBlock) {
        $product = $this->getProduct();
        $title = $product->getMetaTitle();
        if ($title) {
            $headBlock->setTitle($title);
        }
 ...
}

Best Answer

This was due to a conflic with FME Ajax Add to cart.

I resolved by commenting out this rewrite in /app/code/local/FME/Ajaxaddtocart/etc/config.xml:

<!--
    Rewrite disabled because it conflicted with CreareSEO redirects
    <rewrite>

    <fme_ajaxaddtocart_productcontroller>
    <from><![CDATA[#^catalog/product/#]]></from>
    <to>/ajaxaddtocart/product/</to>
    </fme_ajaxaddtocart_productcontroller>

</rewrite> -->