ProjectExplorer: Add the usual reparsing guards to addExistingProjects()

Change-Id: I5791007200004a12d3b8bc327ed17304c01d508b
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2019-03-18 17:15:23 +01:00
parent 533c3eaced
commit 2a2a2a6ed2

View File

@@ -3355,7 +3355,8 @@ void ProjectExplorerPluginPrivate::addNewSubproject()
void ProjectExplorerPluginPrivate::addExistingProjects()
{
Node * const currentNode = ProjectTree::findCurrentNode();
QTC_ASSERT(currentNode, return);
if (!currentNode)
return;
ProjectNode *projectNode = currentNode->asProjectNode();
if (!projectNode && currentNode->asContainerNode())
projectNode = currentNode->asContainerNode()->rootProjectNode();
@@ -3364,6 +3365,8 @@ void ProjectExplorerPluginPrivate::addExistingProjects()
QStringList subProjectFilePaths = QFileDialog::getOpenFileNames(
ICore::mainWindow(), tr("Please choose a project file"), dir,
projectNode->subProjectFileNamePatterns().join(";;"));
if (!ProjectTree::hasNode(projectNode))
return;
const QList<Node *> childNodes = projectNode->nodes();
Utils::erase(subProjectFilePaths, [childNodes](const QString &filePath) {
return Utils::anyOf(childNodes, [filePath](const Node *n) {