Skip to content

Commit

Permalink
Handle bad deletion page call
Browse files Browse the repository at this point in the history
  • Loading branch information
matks committed Nov 16, 2023
1 parent fae55dc commit 4d00c37
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion productcomments.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,13 @@ protected function _postProcess()
$commentRepository->deleteReports($id_product_comment);
} elseif (Tools::isSubmit('deleteproductcomments')) {
$comment = $commentRepository->find($id_product_comment);
$commentRepository->delete($comment);

if ($comment === null) {
$this->_html .= $this->displayError($this->trans('The comment cannot be deleted', [], 'Modules.Productcomments.Admin'));
} else {
$commentRepository->delete($comment);
Tools::redirectAdmin($this->context->link->getAdminLink('AdminModules', true, [], ['configure' => $this->name]));
}
} elseif (Tools::isSubmit('submitEditCriterion')) {
$criterion = $criterionRepository->findRelation((int) Tools::getValue('id_product_comment_criterion'));
$criterion->setType((int) Tools::getValue('id_product_comment_criterion_type'));
Expand Down

0 comments on commit 4d00c37

Please sign in to comment.