Commit 4fefe0c2 authored by Tobias Hunger's avatar Tobias Hunger

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: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 6a8349c9
......@@ -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;
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment