Skip to content

Commit

Permalink
[BUGFIX] Check if the site is not a NullSite before calling getAllLan…
Browse files Browse the repository at this point in the history
…guages() in SelectCategories.php

resolves kartolo#523
  • Loading branch information
Patta authored Oct 18, 2024
1 parent 500a858 commit fce1a02
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Classes/SelectCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand All @@ -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'])) {
Expand Down

0 comments on commit fce1a02

Please sign in to comment.