Skip to content

Commit

Permalink
catch in case of external route with no route parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
rpnykanen committed Dec 20, 2024
1 parent e6e0d1c commit c026d7c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion hdbt.theme
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,13 @@ function hdbt_preprocess_block(&$variables): void {
$front_page = Url::fromRoute('<front>', [], ['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);
Expand Down

0 comments on commit c026d7c

Please sign in to comment.