diff --git a/core/lib/Thelia/Controller/Admin/CouponController.php b/core/lib/Thelia/Controller/Admin/CouponController.php index abf3177aa..db199c23a 100644 --- a/core/lib/Thelia/Controller/Admin/CouponController.php +++ b/core/lib/Thelia/Controller/Admin/CouponController.php @@ -622,16 +622,21 @@ class CouponController extends BaseAdminController return $response; } - $this->checkXmlHttpRequest(); + if (! empty($couponServiceId)) { + $this->checkXmlHttpRequest(); - /** @var CouponInterface $coupon */ - $couponManager = $this->container->get($couponServiceId); + /** @var CouponInterface $coupon */ + $couponManager = $this->container->get($couponServiceId); - if (!$couponManager instanceof CouponInterface) { - $this->pageNotFound(); + if (!$couponManager instanceof CouponInterface) { + $this->pageNotFound(); + } + + $response = new ResponseRest($couponManager->drawBackOfficeInputs()); + } + else { + $response = new ResponseRest(''); } - - $response = new ResponseRest($couponManager->drawBackOfficeInputs()); return $response; }