[libcalamares] Shuffle module-loading logic

- group ifs by the state of thisModule
This commit is contained in:
Adriaan de Groot 2020-01-21 19:55:46 +01:00
parent 58931d99fa
commit 974d795390

View File

@ -266,16 +266,22 @@ ModuleManager::loadModules()
// exists and is valid, but that's the only thing that could fail
// from this point on. -- Teo 8/2015
Module* thisModule = m_loadedModulesByInstanceKey.value( instanceKey, nullptr );
if ( thisModule && !thisModule->isLoaded() )
if ( thisModule )
{
cError() << "Module" << instanceKey.toString() << "exists but not loaded.";
failedModules.append( instanceKey.toString() );
continue;
}
if ( thisModule && thisModule->isLoaded() )
{
cDebug() << "Module" << instanceKey.toString() << "already loaded.";
if ( thisModule->isLoaded() )
{
// It's been listed before, don't bother loading again.
// This can happen for a module listed twice (e.g. with custom instances)
cDebug() << "Module" << instanceKey.toString() << "already loaded.";
}
else
{
// An attempt was made, earlier, and that failed.
// This can happen for a module listed twice (e.g. with custom instances)
cError() << "Module" << instanceKey.toString() << "exists but not loaded.";
failedModules.append( instanceKey.toString() );
continue;
}
}
else
{