From ec5a669b395debbda2aab3fa04bdb8504d55eb9a Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 19 Jan 2017 10:22:38 +0100 Subject: [PATCH] ProjectExplorer: Disable copying steps to inactive kits This fixes a hard crash due to a Target nullptr. Change-Id: I3065ac61bc950413d8958bcad5420f5868afd35c Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/project.cpp | 1 + src/plugins/projectexplorer/targetsettingspanel.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/project.cpp b/src/plugins/projectexplorer/project.cpp index b48f8d36dd6..945fef74aab 100644 --- a/src/plugins/projectexplorer/project.cpp +++ b/src/plugins/projectexplorer/project.cpp @@ -276,6 +276,7 @@ Target *Project::createTarget(Kit *k) bool Project::copySteps(Target *sourceTarget, Target *newTarget) { + QTC_ASSERT(newTarget, return false); bool fatalError = false; QStringList buildconfigurationError; QStringList deployconfigurationError; diff --git a/src/plugins/projectexplorer/targetsettingspanel.cpp b/src/plugins/projectexplorer/targetsettingspanel.cpp index 17121533018..c6c237e2e37 100644 --- a/src/plugins/projectexplorer/targetsettingspanel.cpp +++ b/src/plugins/projectexplorer/targetsettingspanel.cpp @@ -447,7 +447,7 @@ public: }); QMenu *copyMenu = menu->addMenu(tr("Copy Steps From Other Kit...")); - if (m_kitId.isValid()) { + if (m_kitId.isValid() && m_project->target(m_kitId)) { const QList kits = KitManager::kits(); for (Kit *kit : kits) { QAction *copyAction = copyMenu->addAction(kit->displayName());