From eda14ce548b2fd0a0d397c6956c64b50dd0d38f5 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 6 Aug 2020 12:38:55 +0200 Subject: [PATCH] [locale] Avoid nullptr deref - when no location has been set at all, there's no sensible TZ to report; just leave it blank. In *practice* you won't hit this code from the Calamares UI before a location has been set, because the Config object is instantiated and then immediately configured, but from tests or unusual UIs it could be. --- src/modules/locale/Config.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modules/locale/Config.cpp b/src/modules/locale/Config.cpp index ecd704186..a6d3e5222 100644 --- a/src/modules/locale/Config.cpp +++ b/src/modules/locale/Config.cpp @@ -318,7 +318,9 @@ Config::setLCLocaleExplicitly( const QString& locale ) QString Config::currentLocationStatus() const { - return tr( "Set timezone to %1/%2." ).arg( m_currentLocation->region(), m_currentLocation->zone() ); + return tr( "Set timezone to %1/%2." ) + .arg( m_currentLocation ? m_currentLocation->region() : QString(), + m_currentLocation ? m_currentLocation->zone() : QString() ); } static inline QString