From e9a98f35ad1b61e0d60f3c28f110fe482f99d102 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 24 Aug 2021 11:58:24 +0200 Subject: [PATCH] [welcome] Avoid crash when no Branding available - don't install translators twice -- do it in setLocaleIndex only - avoid crash if the branding instance is nullptr --- src/modules/welcome/Config.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index bc489d186..52cd4c88d 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -152,8 +152,6 @@ Config::initLanguages() { QString name = m_languages->locale( matchedLocaleIndex ).name(); cDebug() << Logger::SubEntry << "Matched with index" << matchedLocaleIndex << name; - - CalamaresUtils::installTranslator( name, Calamares::Branding::instance()->translationsDirectory() ); setLocaleIndex( matchedLocaleIndex ); } else @@ -192,7 +190,8 @@ Config::setLocaleIndex( int index ) cDebug() << "Index" << index << "Selected locale" << selectedLocale; QLocale::setDefault( selectedLocale ); - CalamaresUtils::installTranslator( selectedLocale, Calamares::Branding::instance()->translationsDirectory() ); + const auto* branding = Calamares::Branding::instance(); + CalamaresUtils::installTranslator( selectedLocale, branding ? branding->translationsDirectory() : QString() ); if ( Calamares::JobQueue::instance() && Calamares::JobQueue::instance()->globalStorage() ) { CalamaresUtils::Locale::insertGS( *Calamares::JobQueue::instance()->globalStorage(),