diff --git a/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php b/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php index f1822c3..9adc340 100644 --- a/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php +++ b/core/modules/rest/src/Plugin/Derivative/EntityDerivative.php @@ -114,12 +114,16 @@ public function getDerivativeDefinitions($base_plugin_definition) { // @todo remove the try/catch as part of // http://drupal.org/node/2281645 try { - if (($collection = $this->routeBuilder->getCollectionDuringRebuild()) && $route = $collection->get($route_name)) { + if ($collection = $this->routeBuilder->getCollectionDuringRebuild()) { + $route = $collection->get($route_name); } else { $route = $this->routeProvider->getRouteByName($route_name); } - $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = $route->getPath(); + + if ($route) { + $this->derivatives[$entity_type_id]['uri_paths'][$link_relation] = $route->getPath(); + } } catch (RouteNotFoundException $e) { // If the route does not exist it means we are in a brittle state