From 0120781b85e8a56335c28da9e843743d243cb683 Mon Sep 17 00:00:00 2001
From: Georg Ringer <georg.ringer@gmail.com>
Date: Wed, 11 May 2022 14:02:19 +0200
Subject: [PATCH] [BUGFIX] Fix notice for browse menu with no parent page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix a notice if a browse menu is being generated but no parent page
is available.

Resolves: #97608
Releases: main, 11.5
Change-Id: Id0674fddccf62e02febdfa7b609521d0db3114b1
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/74603
Tested-by: core-ci <typo3@b13.com>
Tested-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com>
Tested-by: Nikita Hovratov <nikita.h@live.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: crell <larry@garfieldtech.com>
Reviewed-by: Simon Schaufelberger <simonschaufi+typo3@gmail.com>
Reviewed-by: Torben Hansen <derhansen@gmail.com>
Reviewed-by: Nikita Hovratov <nikita.h@live.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
---
 .../Classes/ContentObject/Menu/AbstractMenuContentObject.php    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
index db188037ebfb..d1cb436b9625 100644
--- a/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
+++ b/typo3/sysext/frontend/Classes/ContentObject/Menu/AbstractMenuContentObject.php
@@ -992,7 +992,7 @@ abstract class AbstractMenuContentObject
                 $recArr['up'] = $this->sys_page->getPage($value_rec['pid']);
             }
             // If the 'up' item was NOT level 0 in rootline...
-            if ($recArr['up']['pid'] && $value_rec['pid'] != $this->tmpl->rootLine[0]['uid']) {
+            if (($recArr['up']['pid'] ?? 0) && $value_rec['pid'] != $this->tmpl->rootLine[0]['uid']) {
                 // The page record of "index".
                 $recArr['index'] = $this->sys_page->getPage($recArr['up']['pid']);
             }
-- 
GitLab