diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-10-18 11:33:18 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-10-18 12:29:44 +0000 |
commit | 5bc38589d8049d10d5c8401c27e576c5029aeacf (patch) | |
tree | a20222d6f1f4fc97916400f1f921e611d5575598 /src/plugins/projectexplorer/jsonwizard | |
parent | e06c8672ac85f8bba01e437ff9fbb06cdfd2653e (diff) |
Fix crash when adding file to sub folder in generic project
The moment the file is added to the project, a reparse is triggered,
which invalidates the tree sub-nodes.
So we need to check if the context node (on which the wizard was opened)
still exists before trying to access it, similar to how we do that in
JsonSummaryPage::findWizardContextNode.
Change-Id: I9154e000a31ea8d5d4ebc66c25528d422c377b94
Fixes: QTCREATORBUG-21342
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/jsonwizard')
-rw-r--r-- | src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp index c708dd5af4..894fadcfa4 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp @@ -31,6 +31,7 @@ #include "../project.h" #include "../projectexplorer.h" #include "../projectexplorerconstants.h" +#include "../projecttree.h" #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/messagemanager.h> @@ -290,7 +291,7 @@ void JsonWizard::accept() openFiles(m_files); auto node = static_cast<ProjectExplorer::Node*>(value(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE).value<void*>()); - if (node) // PREFERRED_PROJECT_NODE is not set for newly created projects + if (node && ProjectTree::hasNode(node)) // PREFERRED_PROJECT_NODE is not set for newly created projects openProjectForNode(node); } |