[users] Protect against JobQueue or GS being NULL

- Avoid SIGSEGV in tests, make sure JobQueue exists, GS optional
This commit is contained in:
Adriaan de Groot 2020-10-14 01:15:16 +02:00
parent 788a233319
commit 6b2d7f6a42
2 changed files with 10 additions and 0 deletions

View File

@ -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() )
{

View File

@ -53,6 +53,11 @@ UserTests::initTestCase()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
cDebug() << "Users test started.";
if ( !Calamares::JobQueue::instance() )
{
(void)new Calamares::JobQueue();
}
}
void