diff --git a/src/CurrentTranslationLoader.php b/src/CurrentTranslationLoader.php index 4ee460b..41e889a 100644 --- a/src/CurrentTranslationLoader.php +++ b/src/CurrentTranslationLoader.php @@ -55,9 +55,14 @@ public function initializeCurrentTranslation(TranslatableInterface $entity) $translationService = $this->container->get('object_bg.translation.service.translation'); /** @var Language $currentLanguage */ $currentLanguage = $translationService->getCurrentLanguage(); - $success = $this->initializeTranslation($entity, $currentLanguage); - $locale = $currentLanguage->getLocale(); + $locale = null; + $success = false; + + if ($currentLanguage) { + $success = $this->initializeTranslation($entity, $currentLanguage); + $locale = $currentLanguage->getLocale(); + } if ($success == false) { $locale = $this->initializeFallbackTranslation($entity);