X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/07b889547d28e68e5fc8f923c166bd607da17ad7..refs/pull/2515/head:/app/Entities/BreadcrumbsViewComposer.php diff --git a/app/Entities/BreadcrumbsViewComposer.php b/app/Entities/BreadcrumbsViewComposer.php index 97ddbc2dc..cf7cf296c 100644 --- a/app/Entities/BreadcrumbsViewComposer.php +++ b/app/Entities/BreadcrumbsViewComposer.php @@ -1,5 +1,7 @@ entityContextManager = $entityContextManager; } @@ -23,8 +25,9 @@ class BreadcrumbsViewComposer public function compose(View $view) { $crumbs = $view->getData()['crumbs']; - if (array_first($crumbs) instanceof Book) { - $shelf = $this->entityContextManager->getContextualShelfForBook(array_first($crumbs)); + $firstCrumb = $crumbs[0] ?? null; + if ($firstCrumb instanceof Book) { + $shelf = $this->entityContextManager->getContextualShelfForBook($firstCrumb); if ($shelf) { array_unshift($crumbs, $shelf); $view->with('crumbs', $crumbs);