Merge pull request #4620 from OPM/bug-#4617

#4617 Disallow creating ensemble curve sets if you have no ensemble
This commit is contained in:
Magne Sjaastad
2019-08-22 14:16:12 +02:00
committed by GitHub

View File

@@ -100,7 +100,17 @@ void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(RimSum
//--------------------------------------------------------------------------------------------------
bool RicNewSummaryEnsembleCurveSetFeature::isCommandEnabled()
{
return (selectedSummaryPlot());
bool summaryPlotSelected = selectedSummaryPlot();
if (summaryPlotSelected)
{
RimProject* project = RiaApplication::instance()->project();
CVF_ASSERT(project);
if (!project->summaryGroups().empty())
{
return true;
}
}
return false;
}
//--------------------------------------------------------------------------------------------------
@@ -114,6 +124,7 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered(bool isChecked)
RimSummaryPlot* plot = selectedSummaryPlot();
if (plot)
{
CVF_ASSERT(!project->summaryGroups().empty());
auto ensemble = project->summaryGroups().back();
RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(ensemble);