diff --git a/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp b/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp index ea35fecfb3..26e883fbe7 100644 --- a/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp +++ b/ApplicationCode/Commands/WellPathCommands/RicWellPathExportCompletionDataFeature.cpp @@ -76,13 +76,20 @@ void RicWellPathExportCompletionDataFeature::onActionTriggered(bool isChecked) QString defaultDir = RiaApplication::instance()->lastUsedDialogDirectoryWithFallback("COMPLETIONS", projectFolder); RimExportCompletionDataSettings exportSettings; + std::vector cases; + app->project()->allCases(cases); + for (auto c : cases) + { + RimEclipseCase* eclipseCase = dynamic_cast(c); + if (eclipseCase != nullptr) + { + exportSettings.caseToApply = eclipseCase; + break; + } + } exportSettings.fileName = QDir(defaultDir).filePath("Completions"); - RimEclipseCase* caseToApply; - objects[0]->firstAncestorOrThisOfType(caseToApply); - exportSettings.caseToApply = caseToApply; - caf::PdmUiPropertyViewDialog propertyDialog(RiuMainWindow::instance(), &exportSettings, "Export Completion Data", ""); if (propertyDialog.exec() == QDialog::Accepted) {