From 289e22164c0a46f35c6e774e51bcd8a6bfad2d42 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 29 Mar 2011 14:45:21 +0200 Subject: [PATCH] Analyzer: Fix a crash when launching on a QML project. Which does not have a build configuration. Reviewed-by: Bill King --- src/plugins/analyzerbase/analyzermanager.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/analyzerbase/analyzermanager.cpp b/src/plugins/analyzerbase/analyzermanager.cpp index ee872b9950d..0cb52228a8c 100644 --- a/src/plugins/analyzerbase/analyzermanager.cpp +++ b/src/plugins/analyzerbase/analyzermanager.cpp @@ -453,12 +453,21 @@ void AnalyzerManager::AnalyzerManagerPrivate::startTool() ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance(); - ProjectExplorer::Project *pro = pe->startupProject(); // ### not sure if we're supposed to check if the RunConFiguration isEnabled - if (!pro || !pro->activeTarget()->activeRunConfiguration()->isEnabled()) + ProjectExplorer::Project *pro = pe->startupProject(); + const ProjectExplorer::RunConfiguration *runConfig = 0; + ProjectExplorer::BuildConfiguration::BuildType buildType = ProjectExplorer::BuildConfiguration::Unknown; + if (pro) { + if (const ProjectExplorer::Target *target = pro->activeTarget()) { + runConfig = target->activeRunConfiguration(); + // Build configuration is 0 for QML projects. + if (const ProjectExplorer::BuildConfiguration *buildConfig = target->activeBuildConfiguration()) + buildType = buildConfig->buildType(); + } + } + if (!runConfig || !runConfig->isEnabled()) return; - ProjectExplorer::BuildConfiguration::BuildType buildType = pro->activeTarget()->activeBuildConfiguration()->buildType(); IAnalyzerTool::ToolMode toolMode = q->currentTool()->mode(); // check the project for whether the build config is in the correct mode