diff --git a/src/plugins/cmakeprojectmanager/cmakeproject.cpp b/src/plugins/cmakeprojectmanager/cmakeproject.cpp index 5aac57556ed..24f1ad94281 100644 --- a/src/plugins/cmakeprojectmanager/cmakeproject.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeproject.cpp @@ -140,6 +140,9 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM connect(this, &Project::activeTargetChanged, this, [this]() { CMakeBuildConfiguration *bc = activeBc(this); + if (!bc) + return; + // Target has switched, so the kit has changed, too. // * run cmake with configuration arguments if the reader needs to be switched // * run cmake without configuration arguments if the reader stays @@ -153,6 +156,9 @@ CMakeProject::CMakeProject(const FileName &fileName) : Project(Constants::CMAKEM subscribeSignal(&Target::activeBuildConfigurationChanged, this, [this]() { CMakeBuildConfiguration *bc = activeBc(this); + if (!bc) + return; + // Build configuration has switched: // * Error out if the reader updates, can not happen since all BCs share a target/kit. // * run cmake without configuration arguments if the reader stays