From d45b2a66ffb4d7e079b26c34d8006018bf1e4637 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Kalij=C3=A4rvi?= Date: Mon, 5 Feb 2024 08:59:21 +0200 Subject: [PATCH] Fixed 'Call to a member function getTotalPages() on null' error. --- hdbt.theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdbt.theme b/hdbt.theme index b0476dc81..011dfd932 100644 --- a/hdbt.theme +++ b/hdbt.theme @@ -1577,7 +1577,7 @@ function hdbt_preprocess_pager(&$variables): void { $pager_manager = \Drupal::service('pager.manager'); $pager = $pager_manager->getPager($element); // Get the total pages in the pager. - $total_pages = $pager->getTotalPages(); + $total_pages = isset($pager) ? $pager->getTotalPages() : 0; $variables['total_pages'] = $total_pages; }