From bdeb0aab4f67f08bce0c8cffc2f833478dd65f26 Mon Sep 17 00:00:00 2001 From: Guy Marriott Date: Mon, 29 Jun 2020 12:09:10 -0700 Subject: [PATCH] Merge pull request #9565 from tom890180/check_items_exist --- .../GridField/GridFieldDetailForm_ItemRequest.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php index 3e35bcfeb..1f204fe90 100644 --- a/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php +++ b/src/Forms/GridField/GridFieldDetailForm_ItemRequest.php @@ -452,8 +452,10 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler if ($toplevelController->hasMethod('Backlink')) { $backlink = $toplevelController->Backlink(); } elseif ($this->popupController->hasMethod('Breadcrumbs')) { - $parents = $this->popupController->Breadcrumbs(false)->items; - $backlink = array_pop($parents)->Link; + $parents = $this->popupController->Breadcrumbs(false); + if ($parents && $parents = $parents->items) { + $backlink = array_pop($parents)->Link; + } } } if (!$backlink) { @@ -774,6 +776,10 @@ class GridFieldDetailForm_ItemRequest extends RequestHandler /** @var ArrayList $items */ $items = $this->popupController->Breadcrumbs($unlinked); + if (!$items) { + $items = new ArrayList(); + } + if ($this->record && $this->record->ID) { $title = ($this->record->Title) ? $this->record->Title : "#{$this->record->ID}"; $items->push(new ArrayData([