[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:
Adriaan de Groot 2018-02-19 09:47:15 -05:00
parent 94014a52d4
commit cf02f7aab5

View File

@ -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;
} }