From 6b2d7f6a4259cf575a5736749bd5789d0bfc7db8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 14 Oct 2020 01:15:16 +0200 Subject: [PATCH] [users] Protect against JobQueue or GS being NULL - Avoid SIGSEGV in tests, make sure JobQueue exists, GS optional --- src/modules/users/Config.cpp | 5 +++++ src/modules/users/Tests.cpp | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/modules/users/Config.cpp b/src/modules/users/Config.cpp index b3d94666a..da57db0fc 100644 --- a/src/modules/users/Config.cpp +++ b/src/modules/users/Config.cpp @@ -34,6 +34,11 @@ static void updateGSAutoLogin( bool doAutoLogin, const QString& login ) { Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage(); + if ( !gs ) + { + cWarning() << "No Global Storage available"; + return; + } if ( doAutoLogin && !login.isEmpty() ) { diff --git a/src/modules/users/Tests.cpp b/src/modules/users/Tests.cpp index e973868db..3d4aa8694 100644 --- a/src/modules/users/Tests.cpp +++ b/src/modules/users/Tests.cpp @@ -53,6 +53,11 @@ UserTests::initTestCase() { Logger::setupLogLevel( Logger::LOGDEBUG ); cDebug() << "Users test started."; + + if ( !Calamares::JobQueue::instance() ) + { + (void)new Calamares::JobQueue(); + } } void