Follow-up to #54160: Throw exception when current language is not found in Language...
authorstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Fri, 17 Jan 2014 18:00:10 +0000 (18:00 +0000)
committerstan <stan@735d13b6-9817-0410-8766-e36946ffe9aa>
Fri, 17 Jan 2014 18:00:10 +0000 (18:00 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/static_info_tables/trunk@83269 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
Classes/Utility/LocalizationUtility.php

index 4110185..1ef033e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2014-01-17  Stanislas Rolland  <typo3@sjbr.ca>
 
        * Follow-up to #54160: List module broken on root page
+       * Follow-up to #54160: Throw exception when current language is not found in Language repository
 
 2014-01-16  Stanislas Rolland  <typo3@sjbr.ca>
 
index c3a36fc..05b909d 100644 (file)
@@ -280,7 +280,12 @@ class LocalizationUtility {
                        $languageRepository = $objectManager->get('SJBR\\StaticInfoTables\\Domain\\Repository\\LanguageRepository');
                        list($languageIsoCodeA2, $countryIsoCodeA2) = explode('_', $languageCode, 2);
                        $language = $languageRepository->findOneByIsoCodes($languageIsoCodeA2, $countryIsoCodeA2 ? $countryIsoCodeA2 : '');
-                       self::$collatingLocale = $language->getCollatingLocale();
+                       if (is_object($language)) {
+                               self::$collatingLocale = $language->getCollatingLocale();
+                       } else {
+                               // This should not happen: current language was not found in the Language repository
+                               throw new \TYPO3\CMS\Extbase\Exception('Current language "' . $languageCode . '" could not be found in Language repository.', 1389981393);
+                       }
                }
                return setlocale(LC_COLLATE,
                        array(