Designer: Fix crash for CMake projects without cmake configured

When using the Wizard to configure a project using a Kit that doesn't
have a CMake tool configured Qt Creator would crash.

Fixes: QTCREATORBUG-32490
Change-Id: I16e0bb3d91e008f41ce55ef92b28ce92bbcbd6e6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Cristian Adam
2025-02-12 21:14:59 +01:00
parent 93bebe1917
commit d275c50c03

View File

@@ -94,7 +94,8 @@ static void reportRenamingError(const QString &oldName, const QString &reason)
static std::optional<QVersionNumber> qtVersionFromProject(const Project *project) static std::optional<QVersionNumber> qtVersionFromProject(const Project *project)
{ {
if (const auto *kit = project->activeKit(); kit->isValid()) { const auto *kit = project->activeKit();
if (kit && kit->isValid()) {
if (const auto *qtVersion = QtSupport::QtKitAspect::qtVersion(kit)) if (const auto *qtVersion = QtSupport::QtKitAspect::qtVersion(kit))
return qtVersion->qtVersion(); return qtVersion->qtVersion();
} }