forked from qt-creator/qt-creator
JsonWizard: Code cleanup
Make sure project is 0, clang reports a free after use otherwise. Clean up the code a bit. Change-Id: Ie21cc83c589fdc5eed197bd3f005b309c000cc0d Reviewed-by: Daniel Teske <daniel.teske@theqtcompany.com>
This commit is contained in:
@@ -40,6 +40,7 @@
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
#include <utils/macroexpander.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -96,18 +97,13 @@ void JsonKitsPage::setupProjectFiles(const JsonWizard::GeneratorFiles &files)
|
||||
if (mt.isNull())
|
||||
continue;
|
||||
|
||||
foreach (IProjectManager *manager, managerList) {
|
||||
if (manager->mimeType() == mt.type()) {
|
||||
project = manager->openProject(path, &errorMessage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
auto manager = Utils::findOrDefault(managerList, Utils::equal(&IProjectManager::mimeType, mt.type()));
|
||||
project = manager ? manager->openProject(path, &errorMessage) : 0;
|
||||
if (project) {
|
||||
bool success = setupProject(project);
|
||||
if (success)
|
||||
if (setupProject(project))
|
||||
project->saveSettings();
|
||||
delete project;
|
||||
project = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user