subiquity/controllers: fix failure when LANG is unset

Do not crash when LANG is unset.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
This commit is contained in:
Maciej Borzecki 2020-04-02 08:03:57 +02:00
parent 291e1950ba
commit 60b455701b
1 changed files with 1 additions and 1 deletions

View File

@ -37,7 +37,7 @@ class WelcomeController(SubiquityController):
def start(self):
lang = os.environ.get("LANG")
if lang.endswith(".UTF-8"):
if lang is not None and lang.endswith(".UTF-8"):
lang = lang.rsplit('.', 1)[0]
for code, name in self.model.supported_languages:
if code == lang: