diff --git a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp index 8db6d46cac9..a5a6b7582a0 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonsummarypage.cpp @@ -90,7 +90,14 @@ void JsonSummaryPage::initializePage() connect(m_wizard, &JsonWizard::filesReady, this, &JsonSummaryPage::triggerCommit); connect(m_wizard, &JsonWizard::filesReady, this, &JsonSummaryPage::addToProject); + // set result to accepted, so we can check if updateFileList -> m_wizard->generateFileList + // called reject() + m_wizard->setResult(QDialog::Accepted); updateFileList(); + // if there were errors while updating the file list, the dialog is rejected + // so don't continue the setup (which also avoids showing the error message again) + if (m_wizard->result() == QDialog::Rejected) + return; IWizardFactory::WizardKind kind = wizardKind(m_wizard); bool isProject = (kind == IWizardFactory::ProjectWizard); diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp index c6f6900d045..e48f93e9928 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfilegenerator.cpp @@ -238,13 +238,17 @@ Core::GeneratedFiles JsonWizardFileGenerator::fileList(MacroExpander *expander, } const Core::GeneratedFiles result - = Utils::transform(fileList, - [this, &expander, &errorMessage](const File &f) { - return generateFile(f, expander, errorMessage); - }); + = Utils::transform(fileList, [this, &expander, &errorMessage](const File &f) { + QString generateError; + const Core::GeneratedFile file = generateFile(f, expander, &generateError); + if (!generateError.isEmpty()) + *errorMessage = generateError; + return file; + }); - if (Utils::contains(result, - [](const Core::GeneratedFile &gf) { return gf.filePath().isEmpty(); })) + if (Utils::contains(result, [](const Core::GeneratedFile &gf) { + return gf.filePath().isEmpty(); + })) return Core::GeneratedFiles(); return result;