Commit f2615156 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Fix possible crash in the generic project

Make sure we have a RunConfiguration after importing a project from
earlier versions of creator.

Tasknumber: QTCREATORBUG-1277
parent 63340d87
......@@ -34,6 +34,7 @@
#include "generictarget.h"
#include <projectexplorer/buildenvironmentwidget.h>
#include <projectexplorer/customexecutablerunconfiguration.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <cpptools/cppmodelmanagerinterface.h>
......@@ -435,7 +436,19 @@ bool GenericProject::fromMap(const QVariantMap &map)
if (!Project::fromMap(map))
return false;
// Add default BC:
// Sanity check: We need both a buildconfiguration and a runconfiguration!
QList<Target *> targetList = targets();
foreach (Target *t, targetList) {
if (!t->activeBuildConfiguration()) {
delete t;
if (!t->activeRunConfiguration())
t->addRunConfiguration(new ProjectExplorer::CustomExecutableRunConfiguration(t));
// Add default setup:
if (targets().isEmpty())
addTarget(targetFactory()->create(this, QLatin1String(GENERIC_DESKTOP_TARGET_ID)));
Supports Markdown
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