diff options
author | Jarek Kobus <[email protected]> | 2013-10-23 15:02:56 +0200 |
---|---|---|
committer | Jarek Kobus <[email protected]> | 2013-10-23 15:31:39 +0200 |
commit | c24eed11068be214ebf52deca7df41ca56af8ae5 (patch) | |
tree | 9475715b1ee2bab0cda78b3f338c46686dd061a5 | |
parent | 9795976a6b82760729b58b111c99f8cdd9f32a27 (diff) |
Check if project and its target are not null
Task-number: QTCREATORBUG-10437
Fix also the code, so that we always behave like target platform, not like
host platform.
Change-Id: I4d8705ca858f9a520dcd6a780e7ba2f2dd6cb047
Reviewed-by: Daniel Teske <[email protected]>
-rw-r--r-- | src/plugins/qt4projectmanager/librarydetailscontroller.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp index ce67ed4fed4..72536849664 100644 --- a/src/plugins/qt4projectmanager/librarydetailscontroller.cpp +++ b/src/plugins/qt4projectmanager/librarydetailscontroller.cpp @@ -84,14 +84,24 @@ LibraryDetailsController::LibraryDetailsController( if (!Utils::HostOsInfo::isLinuxHost()) { // project for which we are going to insert the snippet - const ProjectExplorer::Project *project = - ProjectExplorer::SessionManager::projectForFile(proFile); - // if its tool chain is maemo behave the same as we would be on linux - ProjectExplorer::ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(project->activeTarget()->kit()); - if (tc - && (tc->targetAbi().osFlavor() == ProjectExplorer::Abi::HarmattanLinuxFlavor - || tc->targetAbi().osFlavor() == ProjectExplorer::Abi::MaemoLinuxFlavor)) - m_creatorPlatform = CreatorLinux; + const Project *project = SessionManager::projectForFile(proFile); + if (project && project->activeTarget()) { + // if its tool chain is maemo behave the same as we would be on linux + ProjectExplorer::ToolChain *tc = ToolChainKitInformation::toolChain(project->activeTarget()->kit()); + if (tc) { + switch (tc->targetAbi().os()) { + case Abi::WindowsOS: + m_creatorPlatform = CreatorWindows; + break; + case Abi::MacOS: + m_creatorPlatform = CreatorMac; + break; + default: + m_creatorPlatform = CreatorLinux; + break; + } + } + } } setPlatformsVisible(true); |