From 7ec7fcfa5ec4919a0be40d2e9a4a44e00e76eb19 Mon Sep 17 00:00:00 2001 From: Manuel Raynaud Date: Fri, 10 Jan 2014 09:40:33 +0100 Subject: [PATCH] check if pbject exists before deleting it --- core/lib/Thelia/Model/Category.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/lib/Thelia/Model/Category.php b/core/lib/Thelia/Model/Category.php index 3924f4a99..020dd8c92 100755 --- a/core/lib/Thelia/Model/Category.php +++ b/core/lib/Thelia/Model/Category.php @@ -73,8 +73,9 @@ class Category extends BaseCategory if($productsCategories) { foreach ($productsCategories as $productCategory) { $product = $productCategory->getProduct(); - - $product->delete($con); + if($product) { + $product->delete($con); + } } } } @@ -143,7 +144,9 @@ class Category extends BaseCategory $subCategories = CategoryQuery::findAllChild($this->getId()); foreach($subCategories as $category) { - $category->setDispatcher($this->getDispatcher()); + if (!is_null($this->dispatcher)) { + $category->setDispatcher($this->getDispatcher()); + } $category->delete(); }