QmakePM: Fix potential null dereference

Reported by Coverity.

Change-Id: Ibdb47a711aca4989b22a7f94fd905deff86cb27c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Orgad Shaneh
2022-03-02 22:17:00 +02:00
committed by Orgad Shaneh
parent 631e2c2a4a
commit c2cceee844

View File

@@ -1134,13 +1134,14 @@ QString InternalLibraryDetailsController::snippet() const
const QString proRelavitePath = rootDir.relativeFilePath(proFile().toString());
// project for which we insert the snippet
const Project *project = SessionManager::projectForFile(proFile());
// the build directory of the active build configuration
QDir rootBuildDir = rootDir; // If the project is unconfigured use the project dir
if (ProjectExplorer::Target *t = project->activeTarget())
if (ProjectExplorer::BuildConfiguration *bc = t->activeBuildConfiguration())
rootBuildDir.setPath(bc->buildDirectory().toString());
if (const Project *project = SessionManager::projectForFile(proFile())) {
if (ProjectExplorer::Target *t = project->activeTarget())
if (ProjectExplorer::BuildConfiguration *bc = t->activeBuildConfiguration())
rootBuildDir.setPath(bc->buildDirectory().toString());
}
// the project for which we insert the snippet inside build tree
QFileInfo pfi(rootBuildDir.filePath(proRelavitePath));