diff --git a/Classes/SelectCategories.php b/Classes/SelectCategories.php index c24af3f3..186b6aaf 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'])) {