From 5bc38589d8049d10d5c8401c27e576c5029aeacf Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 18 Oct 2018 11:33:18 +0200 Subject: 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 --- src/plugins/projectexplorer/jsonwizard/jsonwizard.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 #include @@ -290,7 +291,7 @@ void JsonWizard::accept() openFiles(m_files); auto node = static_cast(value(ProjectExplorer::Constants::PREFERRED_PROJECT_NODE).value()); - 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); } -- cgit v1.2.1