Skip to content

Commit e61b700

Browse files
committed
Merge remote-tracking branch 'goinc/MAGETWO-45215' into pr-452
2 parents 9685c11 + a304910 commit e61b700

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

app/code/Magento/Review/Controller/Product/ListAjax.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66
namespace Magento\Review\Controller\Product;
77

8+
use Magento\Framework\Exception\LocalizedException;
89
use Magento\Review\Controller\Product as ProductController;
910
use Magento\Framework\Controller\ResultFactory;
1011

@@ -17,9 +18,13 @@ class ListAjax extends ProductController
1718
*/
1819
public function execute()
1920
{
20-
$this->initProduct();
21-
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
22-
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
21+
if (!$this->initProduct()) {
22+
throw new LocalizedException(__('Cannot initialize product'));
23+
} else {
24+
/** @var \Magento\Framework\View\Result\Layout $resultLayout */
25+
$resultLayout = $this->resultFactory->create(ResultFactory::TYPE_LAYOUT);
26+
}
27+
2328
return $resultLayout;
2429
}
2530
}

0 commit comments

Comments
 (0)