[libcalamares] Don't crash when creating System object

- In tests, a System object might be created without first
   setting up a JobQueue. In that case, there's no instance,
   so no GS to insert into. Avoid crash here.
This commit is contained in:
Adriaan de Groot 2019-07-05 23:20:19 +02:00
parent 39d618c61e
commit 76ce0e4f2b

View File

@ -85,9 +85,11 @@ System::System( bool doChroot, QObject* parent )
{
Q_ASSERT( !s_instance );
s_instance = this;
if ( !doChroot )
if ( !doChroot && Calamares::JobQueue::instance() && Calamares::JobQueue::instance()->globalStorage() )
{
Calamares::JobQueue::instance()->globalStorage()->insert( "rootMountPoint", "/" );
}
}
System::~System()