Commit 804b2fec authored by bojanz's avatar bojanz

Issue #2689279 by hostdog, bojanz: PHP Fatal error: Call to a member function...

Issue #2689279 by hostdog, bojanz: PHP Fatal error: Call to a member function getId() on null in ... /src/Repository/CountryRepository.php on line 104
parent a0eee00f
......@@ -230,7 +230,9 @@ class AddressItem extends FieldItemBase implements AddressInterface {
$this->langcode = $override;
}
elseif (!$this->getEntity()->isTranslatable()) {
$this->langcode = $language_manager->getConfigOverrideLanguage()->getId();
// The getCurrentLanguage fallback is a workaround for core bug #2684873.
$language = $language_manager>getConfigOverrideLanguage() ?: $language_manager->getCurrentLanguage();
$this->langcode = $language->getId();
}
return $this->langcode;
......
......@@ -96,7 +96,9 @@ class CountryRepository extends ExternalCountryRepository implements ExternalCou
* {@inheritdoc}
*/
protected function getDefaultLocale() {
return $this->languageManager->getConfigOverrideLanguage()->getId();
// The getCurrentLanguage() fallback is a workaround for core bug #2684873.
$language = $this->languageManager->getConfigOverrideLanguage() ?: $this->languageManager->getCurrentLanguage();
return $language->getId();
}
}
......@@ -91,7 +91,9 @@ class SubdivisionRepository extends ExternalSubdivisionRepository {
* {@inheritdoc}
*/
protected function getDefaultLocale() {
return $this->languageManager->getConfigOverrideLanguage()->getId();
// The getCurrentLanguage() fallback is a workaround for core bug #2684873.
$language = $this->languageManager->getConfigOverrideLanguage() ?: $this->languageManager->getCurrentLanguage();
return $language->getId();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment