Skip to content

Commit

Permalink
magento#7372: Product images gets removed from "Images And Videos" af…
Browse files Browse the repository at this point in the history
…ter validation alert.

- Add check for product in case of not initialized product.
  • Loading branch information
al.kravchuk committed Jul 6, 2018
1 parent 78ca274 commit d866b18
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ public function execute()
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
$this->messageManager->addExceptionMessage($e);
$data = $this->persistMediaData($product, $data);
$data = isset($product) ? $this->persistMediaData($product, $data) : $data;
$this->getDataPersistor()->set('catalog_product', $data);
$redirectBack = $productId ? true : 'new';
} catch (\Exception $e) {
$this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
$this->messageManager->addErrorMessage($e->getMessage());
$data = $this->persistMediaData($product, $data);
$data = isset($product) ? $this->persistMediaData($product, $data) : $data;
$this->getDataPersistor()->set('catalog_product', $data);
$redirectBack = $productId ? true : 'new';
}
Expand Down

0 comments on commit d866b18

Please sign in to comment.