diff --git a/core/includes/menu.inc b/core/includes/menu.inc
index c90575e..feff621 100644
--- a/core/includes/menu.inc
+++ b/core/includes/menu.inc
@@ -13,6 +13,7 @@
 use Drupal\menu_link\MenuLinkStorageController;
 use Symfony\Component\HttpFoundation\Request;
 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 use Symfony\Component\Routing\Route;
 
 /**
@@ -975,6 +976,9 @@ function menu_item_route_access(Route $route, $href, &$map) {
   catch (NotFoundHttpException $e) {
     return FALSE;
   }
+  catch (ResourceNotFoundException $e) {
+    return FALSE;
+  }
 
   // Populate the map with any matching values from the request.
   $path_bits = explode('/', trim($route->getPath(), '/'));
diff --git a/core/modules/system/lib/Drupal/system/Tests/Routing/RouterPermissionTest.php b/core/modules/system/lib/Drupal/system/Tests/Routing/RouterPermissionTest.php
index 3059164..57d98be 100644
--- a/core/modules/system/lib/Drupal/system/Tests/Routing/RouterPermissionTest.php
+++ b/core/modules/system/lib/Drupal/system/Tests/Routing/RouterPermissionTest.php
@@ -33,8 +33,14 @@ public static function getInfo() {
    * Tests permission requirements on routes.
    */
   public function testPermissionAccess() {
-    $this->drupalGet('router_test/test7');
+    $path = 'router_test/test7';
+    $this->drupalGet($path);
     $this->assertResponse(403, "Access denied for a route where we don't have a permission");
+    // An invalid path should return a FALSE.
+    $map = array();
+    $route = \Drupal::service('router.route_provider')->getRouteByName('router_test_7');
+    $access = menu_item_route_access($route, $path . 'invalid', $map);
+    $this->assertFalse($access, 'Access denied');
 
     $this->drupalGet('router_test/test8');
     $this->assertResponse(403, 'Access denied by default if no access specified');
