CMakePM: Fix crash when hovering in CMake file without a project

Fixes: QTCREATORBUG-31077
Change-Id: I60526fb37e5d8c7713a5b22dfddb3e52c50fc5f7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Cristian Adam
2024-06-18 17:33:28 +02:00
parent ded397ca55
commit b240bfb3db

View File

@@ -330,7 +330,7 @@ void CMakeEditorWidget::findLinkAt(const QTextCursor &cursor,
if (auto project = ProjectTree::currentProject()) {
buffer.replace("${CMAKE_SOURCE_DIR}", project->projectDirectory().path());
if (auto bs = ProjectTree::currentBuildSystem(); bs->buildConfiguration()) {
if (auto bs = ProjectTree::currentBuildSystem(); bs && bs->buildConfiguration()) {
buffer.replace("${CMAKE_BINARY_DIR}", bs->buildConfiguration()->buildDirectory().path());
// Get the path suffix from current source dir to project source dir and apply it