Fix crash when loading a .pyproject into Qt Creator with empty settings

The build system is 0 as long as no kits are created.

Change-Id: Ia7f283071740dabe76ff3dd6b2f59e5ca214b7c2
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Friedemann Kleint
2023-11-29 12:13:43 +01:00
parent c0a3565362
commit b6c3de310e
2 changed files with 4 additions and 2 deletions

View File

@@ -169,7 +169,8 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
// For an IDE things are a bit more complicated because source files might be edited,
// and the directory of the executable might be outdated.
// Here we try to get the directory of the executable, adding all targets
const auto appTargets = activeTarget->buildSystem()->applicationTargets();
auto *bs = activeTarget->buildSystem();
const auto appTargets = bs ? bs->applicationTargets() : QList<BuildTargetInfo>{};
for (const auto &target : appTargets) {
if (target.targetFilePath.isEmpty())
continue;