diff --git a/core/modules/layout_builder/layout_builder.module b/core/modules/layout_builder/layout_builder.module index 4631de2547c..4553f0cada2 100644 --- a/core/modules/layout_builder/layout_builder.module +++ b/core/modules/layout_builder/layout_builder.module @@ -334,7 +334,7 @@ function layout_builder_plugin_filter_layout_alter(array &$definitions, array $e */ function layout_builder_system_breadcrumb_alter(Breadcrumb &$breadcrumb, RouteMatchInterface $route_match, array $context) { // Remove the extra 'Manage display' breadcrumb for Layout Builder defaults. - if ($route_match->getRouteObject()->hasOption('_layout_builder') && $route_match->getParameter('section_storage_type') === 'defaults') { + if ($route_match->getRouteObject() && $route_match->getRouteObject()->hasOption('_layout_builder') && $route_match->getParameter('section_storage_type') === 'defaults') { $links = array_filter($breadcrumb->getLinks(), function (Link $link) use ($route_match) { $entity_type_id = $route_match->getParameter('entity_type_id'); if (!$link->getUrl()->isRouted()) { diff --git a/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderBreadcrumbAlterTest.php b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderBreadcrumbAlterTest.php new file mode 100644 index 00000000000..113adc2576d --- /dev/null +++ b/core/modules/layout_builder/tests/src/Kernel/LayoutBuilderBreadcrumbAlterTest.php @@ -0,0 +1,33 @@ +