diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index e9c3a40001..c698217a3b 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -78,7 +78,7 @@ RimEnsembleCurveSet* RicNewSummaryEnsembleCurveSetFeature::addDefaultCurveSet(Ri void RicNewSummaryEnsembleCurveSetFeature::createPlotForCurveSetAndUpdate(RimSummaryCaseCollection* ensemble) { RiaGuiApplication* app = RiaGuiApplication::instance(); - RimProject* proj = app->project(); + RimProject* proj = app->project(); RimSummaryPlotCollection* summaryPlotCollection = proj->mainPlotCollection->summaryPlotCollection(); RimSummaryPlot* plot = summaryPlotCollection->createSummaryPlotWithAutoTitle(); @@ -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);