SessionManager: Fix possible crashes in session manager

Change-Id: Icd97c765fb4d5b88ff2986b927433e2583817605
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Tobias Hunger
2016-02-17 12:21:41 +01:00
parent 7aa8dc38e9
commit 998c2a7380

View File

@@ -332,7 +332,7 @@ void SessionManager::setActiveBuildConfiguration(Target *target, BuildConfigurat
if (otherProject == target->project()) if (otherProject == target->project())
continue; continue;
Target *otherTarget = otherProject->activeTarget(); Target *otherTarget = otherProject->activeTarget();
if (otherTarget->kit()->id() != kitId) if (!otherTarget || otherTarget->kit()->id() != kitId)
continue; continue;
foreach (BuildConfiguration *otherBc, otherTarget->buildConfigurations()) { foreach (BuildConfiguration *otherBc, otherTarget->buildConfigurations()) {
@@ -360,7 +360,7 @@ void SessionManager::setActiveDeployConfiguration(Target *target, DeployConfigur
if (otherProject == target->project()) if (otherProject == target->project())
continue; continue;
Target *otherTarget = otherProject->activeTarget(); Target *otherTarget = otherProject->activeTarget();
if (otherTarget->kit()->id() != kitId) if (!otherTarget || otherTarget->kit()->id() != kitId)
continue; continue;
foreach (DeployConfiguration *otherDc, otherTarget->deployConfigurations()) { foreach (DeployConfiguration *otherDc, otherTarget->deployConfigurations()) {