From 20d517d701f3d1783fae67ae83ed5123cd16396b Mon Sep 17 00:00:00 2001 From: Rafal Baran Date: Wed, 8 Oct 2025 11:07:57 +0200 Subject: [PATCH] #40213 - Handle no entity exception for attribute set --- .../Catalog/Controller/Adminhtml/Product/Set/Edit.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php index 628344e95867..17ef431d5901 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Set/Edit.php @@ -55,7 +55,15 @@ public function __construct( public function execute() { $this->_setTypeId(); - $attributeSet = $this->attributeSetRepository->get($this->getRequest()->getParam('id')); + + try { + $attributeSet = $this->attributeSetRepository->get($this->getRequest()->getParam('id')); + } catch (NoSuchEntityException $e) { + $this->messageManager->addErrorMessage(__('Could not load attribute set.')); + + return $this->_redirect('*/*/'); + } + if (!$attributeSet->getId()) { return $this->resultRedirectFactory->create()->setPath('catalog/*/index'); }