From eb7caeac90047d057f7f67fababf904ed42875c8 Mon Sep 17 00:00:00 2001
From: Roman Ganin <rganin@ebay.com>
Date: Sun, 15 Mar 2015 16:55:01 +0200
Subject: [PATCH] MAGETWO-33690: Category page displays outdated prices after
 catalog price rule is deleted

- added check for non-empty product list
---
 app/code/Magento/CatalogRule/Model/Rule.php | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/code/Magento/CatalogRule/Model/Rule.php b/app/code/Magento/CatalogRule/Model/Rule.php
index 92fe0e21168..99eb4752f69 100644
--- a/app/code/Magento/CatalogRule/Model/Rule.php
+++ b/app/code/Magento/CatalogRule/Model/Rule.php
@@ -462,7 +462,10 @@ class Rule extends \Magento\Rule\Model\AbstractModel
     public function afterSave()
     {
         if ($this->isObjectNew()) {
-            $this->_ruleProductProcessor->reindexList($this->getMatchingProductIds());
+            $this->getMatchingProductIds();
+            if (!empty($this->_productIds) && is_array($this->_productIds)) {
+                $this->_ruleProductProcessor->reindexList($this->_productIds);
+            }
         } else {
             $this->_ruleProductProcessor->getIndexer()->invalidate();
         }
-- 
GitLab