[libcalamares] Avoid nullptr crashes
- The Python testmodule script can end up calling in to System methods (via System::instance()). This is unusual, and the System instance has not been created at that point. Now, create an instance and warn about it.
This commit is contained in:
parent
94014a52d4
commit
cf02f7aab5
@ -58,8 +58,15 @@ System::~System()
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
System*System::instance()
|
System*
|
||||||
|
System::instance()
|
||||||
{
|
{
|
||||||
|
if ( !s_instance )
|
||||||
|
{
|
||||||
|
cError() << "No Calamares system-object has been created.";
|
||||||
|
cError() << " .. using a bogus instance instead.";
|
||||||
|
return new System( true, nullptr );
|
||||||
|
}
|
||||||
return s_instance;
|
return s_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user