From 6f065b16c6b1e467287fb86c3ca868719cfde3e0 Mon Sep 17 00:00:00 2001 From: Andrei Rosu <30288530+andirosu@users.noreply.github.com> Date: Mon, 7 Apr 2025 08:23:48 +0300 Subject: [PATCH] Update Listpost.php Move condition to prevent Error getName on null --- Block/Category/Listpost.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Block/Category/Listpost.php b/Block/Category/Listpost.php index 0713335d..b5085eb5 100755 --- a/Block/Category/Listpost.php +++ b/Block/Category/Listpost.php @@ -81,8 +81,8 @@ protected function _prepareLayout() if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) { $category = $this->getBlogObject(); - $categoryName = preg_replace('/[^A-Za-z0-9\-]/', ' ', $category->getName()); if ($category) { + $categoryName = preg_replace('/[^A-Za-z0-9\-]/', ' ', $category->getName()); $breadcrumbs->addCrumb($category->getUrlKey(), [ 'label' => __($categoryName), 'title' => __($categoryName)