diff --git a/src/Silex/EventListener/MiddlewareListener.php b/src/Silex/EventListener/MiddlewareListener.php index 32ab4cb83..412bb7b61 100644 --- a/src/Silex/EventListener/MiddlewareListener.php +++ b/src/Silex/EventListener/MiddlewareListener.php @@ -46,7 +46,7 @@ public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); $routeName = $request->attributes->get('_route'); - if (!$route = $this->app['routes']->get($routeName)) { + if (null === $routeName || !$route = $this->app['routes']->get($routeName)) { return; } @@ -71,7 +71,7 @@ public function onKernelResponse(FilterResponseEvent $event) { $request = $event->getRequest(); $routeName = $request->attributes->get('_route'); - if (!$route = $this->app['routes']->get($routeName)) { + if (null === $routeName || !$route = $this->app['routes']->get($routeName)) { return; }