CMake: Better display name in project tree when parsing fails

When project parsing fails, then the project node might be non-nullptr but
empty. This case is handled in setRootProjectNode(...), where such a
node gets discarded (rootProjectNode() will return a nullptr afterwards).

In this case, do not use the project name that came in from the parser as
it might be wrong.

Change-Id: Iec11aa2d88cca7352d957f428aab24b0f1affd49
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
Tobias Hunger
2019-06-17 12:40:20 +02:00
parent c61c499970
commit 0679671547

View File

@@ -317,8 +317,9 @@ void CMakeProject::updateProjectData(CMakeBuildConfiguration *bc)
auto newRoot = generateProjectTree(m_allFiles);
if (newRoot) {
setDisplayName(newRoot->displayName());
setRootProjectNode(std::move(newRoot));
if (rootProjectNode())
setDisplayName(rootProjectNode()->displayName());
for (const CMakeBuildTarget &bt : buildTargets) {
const QString buildKey = CMakeTargetNode::generateId(bt.sourceDirectory, bt.title);