From 3730c17b80906332adb9218d302fc64c8d75e328 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Mon, 22 Nov 2021 17:11:24 +0000 Subject: [PATCH] Issue #3184619 by neclimdul, quietone: Fix unreachable logic in UrlGenerator::getRoute --- core/lib/Drupal/Core/Routing/UrlGenerator.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/core/lib/Drupal/Core/Routing/UrlGenerator.php b/core/lib/Drupal/Core/Routing/UrlGenerator.php index c4276a3d224c..f56736ab267c 100644 --- a/core/lib/Drupal/Core/Routing/UrlGenerator.php +++ b/core/lib/Drupal/Core/Routing/UrlGenerator.php @@ -7,7 +7,6 @@ use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Routing\RequestContext as SymfonyRequestContext; use Symfony\Component\Routing\Route as SymfonyRoute; -use Symfony\Component\Routing\Exception\RouteNotFoundException; use Drupal\Component\Utility\UrlHelper; use Drupal\Core\PathProcessor\OutboundPathProcessorInterface; use Drupal\Core\RouteProcessor\OutboundRouteProcessorInterface; @@ -423,8 +422,8 @@ protected function getRoute($name) { if ($name instanceof SymfonyRoute) { $route = $name; } - elseif (NULL === $route = clone $this->provider->getRouteByName($name)) { - throw new RouteNotFoundException(sprintf('Route "%s" does not exist.', $name)); + else { + $route = clone $this->provider->getRouteByName($name); } return $route; } -- GitLab