forked from qt-creator/qt-creator
CMakePM: Fix crash when editing CMake files without a project
Fixes: QTCREATORBUG-30023 Change-Id: Id849635dd0e7437d7ae93251130d2f26ded24def Reviewed-by: Kai Köhne <kai.koehne@qt.io>
This commit is contained in:
@@ -314,7 +314,9 @@ static void updateCMakeConfigurationWithLocalData(CMakeConfig &cmakeCache,
|
||||
return var == "CMAKE_PREFIX_PATH" || var == "CMAKE_MODULE_PATH";
|
||||
};
|
||||
|
||||
const FilePath projectDir = ProjectTree::currentBuildSystem()->projectDirectory();
|
||||
const FilePath projectDir = ProjectTree::currentBuildSystem()
|
||||
? ProjectTree::currentBuildSystem()->projectDirectory()
|
||||
: currentDir;
|
||||
auto updateDirVariables = [currentDir, projectDir, cmakeCache](QByteArray &value) {
|
||||
value.replace("${CMAKE_CURRENT_SOURCE_DIR}", currentDir.path().toUtf8());
|
||||
value.replace("${CMAKE_CURRENT_LIST_DIR}", currentDir.path().toUtf8());
|
||||
|
Reference in New Issue
Block a user