From fce1a027d7617e56cba7257c683f634610b2ce78 Mon Sep 17 00:00:00 2001 From: Patrick Lenk Date: Fri, 18 Oct 2024 09:56:47 +0200 Subject: [PATCH] [BUGFIX] Check if the site is not a NullSite before calling getAllLanguages() in SelectCategories.php resolves #523 --- Classes/SelectCategories.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Classes/SelectCategories.php b/Classes/SelectCategories.php index c24af3f3c..186b6aafd 100644 --- a/Classes/SelectCategories.php +++ b/Classes/SelectCategories.php @@ -17,6 +17,7 @@ use DirectMailTeam\DirectMail\Repository\TempRepository; use TYPO3\CMS\Core\Localization\LanguageService; +use TYPO3\CMS\Core\Site\Entity\NullSite; use TYPO3\CMS\Core\Utility\GeneralUtility; /** @@ -39,11 +40,17 @@ public function getLocalizedCategories(array &$params): void $lang = $this->getLang(); $site = $params['site']; - $languages = $site->getAllLanguages(); - foreach($languages as $language) { - if($language->getLocale()->getLanguageCode() == $lang) { - $sysLanguageUid = $language->getLanguageId(); + + // Check if the site is not a NullSite before calling getAllLanguages() + if (!$site instanceof NullSite) { + $languages = $site->getAllLanguages(); + foreach ($languages as $language) { + if ($language->getLocale()->getLanguageCode() == $lang) { + $sysLanguageUid = $language->getLanguageId(); + } } + } else { + $sysLanguageUid = 0; } if (is_array($params['items']) && !empty($params['items'])) {