From b240bfb3dbd7b0da4be1490f7262bcc2c5542731 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Tue, 18 Jun 2024 17:33:28 +0200 Subject: [PATCH] CMakePM: Fix crash when hovering in CMake file without a project Fixes: QTCREATORBUG-31077 Change-Id: I60526fb37e5d8c7713a5b22dfddb3e52c50fc5f7 Reviewed-by: Alessandro Portale --- src/plugins/cmakeprojectmanager/cmakeeditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp index 27db33e14d2..92f63ea04c7 100644 --- a/src/plugins/cmakeprojectmanager/cmakeeditor.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeeditor.cpp @@ -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