Magento – Fatal error: Call to a member function getFullActionName() on null

catalogmagento-1product

Iam geting the following error:

PHP Fatal error: Call to a member function getFullActionName() on
null in
/app/code/community/MageWorx/CustomOptions/Model/Catalog/Product/Option.php
on line 1627

And the Line#1627 is :

$action = Mage::app()->getFrontController()->getAction()->getFullActionName();

Would be great if anyone can provide me the solution to this error.
Thanks

Best Answer

Replace this code with:

$action = Mage::app()->getFrontController()->getAction();
if (!$action || $action->getFullActionName() == "catalog_category_view") {
    return parent::getProductOptionCollection($product);
}

PS: In case you got an error in the custom module, first I'll recommend drop a line to the vendor.