[users] Avoid crashes in tests due to nullptr GS

This commit is contained in:
Adriaan de Groot 2020-10-23 12:19:28 +02:00
parent cd8c3089cb
commit 63196ab58f
2 changed files with 9 additions and 0 deletions

View File

@ -66,6 +66,10 @@ STATICTEST QStringList
groupsInTargetSystem()
{
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
if ( !gs )
{
return QStringList();
}
QDir targetRoot( gs->value( "rootMountPoint" ).toString() );
QFileInfo groupsFi( targetRoot.absoluteFilePath( "etc/group" ) );

View File

@ -9,6 +9,7 @@
#include "CreateUserJob.h"
#include "JobQueue.h"
#include "utils/Logger.h"
#include <QDir>
@ -37,6 +38,10 @@ GroupTests::initTestCase()
{
Logger::setupLogLevel( Logger::LOGDEBUG );
cDebug() << "Users test started.";
if ( !Calamares::JobQueue::instance() )
{
(void)new Calamares::JobQueue();
}
}
void