From 1e4049dc07fdd4f457759f99491cb4603572a5b2 Mon Sep 17 00:00:00 2001 From: Alex Lombry Date: Mon, 2 Mar 2015 15:57:56 +0100 Subject: [PATCH] Check existance locale before try to get id property Delete extra parenthesis --- src/Vinkla/Translator/TranslatorTrait.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Vinkla/Translator/TranslatorTrait.php b/src/Vinkla/Translator/TranslatorTrait.php index 13b0409..8b13a35 100644 --- a/src/Vinkla/Translator/TranslatorTrait.php +++ b/src/Vinkla/Translator/TranslatorTrait.php @@ -201,13 +201,9 @@ private function getTranslationByLocaleId($localeId) */ private function getLocaleId($locale = null) { - $existLocale = $this->getLocale($locale ?: App::getLocale()); - - if (is_null($existLocale)) { - return $this->getFallbackLocaleId(); - } - - return $this->getLocale($locale ?: App::getLocale())->id; + $exist = $this->getLocale($locale ?: App::getLocale()); + + return $exist ? $exist->id : null; } /**