From c026d7ca7a04be78a8884290aed423c134b9557e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Risto=20Nyk=C3=A4nen?= Date: Fri, 20 Dec 2024 12:16:54 +0200 Subject: [PATCH 1/2] catch in case of external route with no route parameters --- hdbt.theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hdbt.theme b/hdbt.theme index 84472d8f6..50922f95c 100644 --- a/hdbt.theme +++ b/hdbt.theme @@ -631,7 +631,13 @@ function hdbt_preprocess_block(&$variables): void { $front_page = Url::fromRoute('', [], ['absolute' => TRUE]); $uri_parts = parse_url($front_page->toString()); $url = Url::fromUri('internal:' . $uri_parts['path']); - $params = $url->getRouteParameters(); + + try { + $params = $url->getRouteParameters(); + } + catch(\Exception $e) { + $params = []; + } if (!empty($params)) { $entity_type = key($params); From c61319f75b74d6480bb2753677127e1768e38040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Risto=20Nyk=C3=A4nen?= Date: Fri, 20 Dec 2024 13:07:45 +0200 Subject: [PATCH 2/2] code fixes --- hdbt.theme | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hdbt.theme b/hdbt.theme index 50922f95c..a193464d1 100644 --- a/hdbt.theme +++ b/hdbt.theme @@ -635,7 +635,7 @@ function hdbt_preprocess_block(&$variables): void { try { $params = $url->getRouteParameters(); } - catch(\Exception $e) { + catch (\Exception $e) { $params = []; }