forked from qt-creator/qt-creator
ProjectExplorer: Treat empty root project nodes better
Do not set up empty root project nodes and fall back to the default project tree instead. A project can not ever be empty: It should at least include the project file itself so that the user can fix breakages when project parsing fails. Change-Id: I692e299f56727305120777cdc532607d5b0be99e Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -461,6 +461,14 @@ void Project::setRootProjectNode(ProjectNode *root)
|
||||
if (d->m_rootProjectNode == root)
|
||||
return;
|
||||
|
||||
if (root && root->nodes().isEmpty()) {
|
||||
// Something went wrong with parsing: At least the project file needs to be
|
||||
// shown so that the user can fix the breakage.
|
||||
// Do not leak root and use default project tree in this case.
|
||||
delete root;
|
||||
root = nullptr;
|
||||
}
|
||||
|
||||
ProjectTree::applyTreeManager(root);
|
||||
|
||||
ProjectNode *oldNode = d->m_rootProjectNode;
|
||||
|
||||
Reference in New Issue
Block a user