Fix crashes when no default profile is set

* Handle 0 when calling createTarget to avoid the crashes in the first place
* Do not try to create/add targets for 0 profiles to avoid creator writing
  a warning to the console
* Fix possible crashes in debugger when no default profile is set.

Task-number: QTCREATORBUG-7695
Change-Id: I9afc8e29c8b859ad078dad794ef5017168daac78
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
Tobias Hunger
2012-08-08 15:39:10 +02:00
parent 240e6a8ae5
commit cac2819838
7 changed files with 16 additions and 11 deletions

View File

@@ -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;
}