diff --git a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp index 84c39c591409de6471f3d655276fd45037b5ff5c..ea88b555a9363477cd3402f3e4f1b306ecf66bcd 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsproject.cpp @@ -158,8 +158,9 @@ bool AutotoolsProject::fromMap(const QVariantMap &map) // Load the project tree structure. evaluateBuildSystem(); - if (!activeTarget()) - addTarget(createTarget(ProfileManager::instance()->defaultProfile())); + Profile *defaultProfile = ProfileManager::instance()->defaultProfile(); + if (!activeTarget() && defaultProfile) + addTarget(createTarget(defaultProfile)); return true; } diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 0b148969ee98363dc5975b63a91a98501e364fe3..aec60ba3ac3818658488cb6f92f02df97f0ff122 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -539,8 +539,9 @@ bool CMakeProject::fromMap(const QVariantMap &map) if (!Project::fromMap(map)) return false; - if (!activeTarget()) - addTarget(createTarget(ProfileManager::instance()->defaultProfile())); + Profile *defaultProfile = ProfileManager::instance()->defaultProfile(); + if (!activeTarget() && defaultProfile) + addTarget(createTarget(defaultProfile)); // We have a user file, but we could still be missing the cbp file // or simply run createXml with the saved settings diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 6cb43e7ebc3706f98fce8487a1a32c9a25007c25..9e92e7681891a6ef8733194f0624cb9b60033370 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1317,7 +1317,8 @@ bool DebuggerPluginPrivate::parseArgument(QStringList::const_iterator &it, return false; } DebuggerStartParameters sp; - fillParameters(&sp, ProfileManager::instance()->defaultProfile()->id()); + Profile *defaultProfile = ProfileManager::instance()->defaultProfile(); + fillParameters(&sp, defaultProfile ? defaultProfile->id() : Core::Id()); qulonglong pid = it->toULongLong(); if (pid) { sp.startMode = AttachExternal; diff --git a/src/plugins/debugger/debuggerrunner.cpp b/src/plugins/debugger/debuggerrunner.cpp index 7e017a71cc0973c38e94d7cfca4780aff60ddc8c..65d0a1f1847a54a38f6de846a670928c18f2d3c9 100644 --- a/src/plugins/debugger/debuggerrunner.cpp +++ b/src/plugins/debugger/debuggerrunner.cpp @@ -877,7 +877,7 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu Target *target = runConfiguration->target(); Profile *profile = target ? target->profile() : ProfileManager::instance()->defaultProfile(); - fillParameters(&sp, profile->id()); + fillParameters(&sp, profile ? profile->id() : Core::Id()); sp.environment = rc->environment(); sp.workingDirectory = rc->workingDirectory(); diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index caeead1f8ad17493b683fc0452b07d595a4e3cdd..769e12f25ac6b7b028d47e2aa8589c3e296cc023 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -429,8 +429,9 @@ bool GenericProject::fromMap(const QVariantMap &map) if (!Project::fromMap(map)) return false; - if (!activeTarget()) - addTarget(createTarget(ProfileManager::instance()->defaultProfile())); + Profile *defaultProfile = ProfileManager::instance()->defaultProfile(); + if (!activeTarget() && defaultProfile) + addTarget(createTarget(defaultProfile)); // Sanity check: We need both a buildconfiguration and a runconfiguration! QList<Target *> targetList = targets(); diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index 37691035810e64540f4e001049bdabb38d8da120..5f25724ee83e3a2d4d6da80636805dd93a94c50e 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -248,7 +248,7 @@ bool Project::supportsProfile(Profile *p) const Target *Project::createTarget(Profile *p) { - if (target(p)) + if (!p || target(p)) return 0; Target *t = new Target(this, p); diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index b0d19997a7999e6d502fdf599505eb7fd76393f0..031878fe907c8588fd27fac08a0a0011ac1f6a7c 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -300,8 +300,9 @@ bool QmlProject::fromMap(const QVariantMap &map) if (!Project::fromMap(map)) return false; - if (!activeTarget()) - addTarget(createTarget(ProjectExplorer::ProfileManager::instance()->defaultProfile())); +ProjectExplorer::Profile *defaultProfile = ProjectExplorer::ProfileManager::instance()->defaultProfile(); + if (!activeTarget() && defaultProfile) + addTarget(createTarget(defaultProfile)); refresh(Everything); // FIXME workaround to guarantee that run/debug actions are enabled if a valid file exists