From 8a41d5a085a52427a7573db277904c8a26e3f177 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 29 Jun 2023 10:48:25 +0200 Subject: [PATCH] #10438 Fix stacking of curves This was a side effect of changes in 69a668d The return value when accessing time step values changed from const std::vector& to std::vector. When computing data related to stacking of curves, the data was inserted into a vector, and the change caused the insert operation to use two different vectors instead of one. --- .../ProjectDataModel/Summary/RimSummaryPlot.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 9c79e44e89..303f422f65 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -1747,7 +1747,12 @@ bool RimSummaryPlot::updateStackedCurveDataForAxis( RiuPlotAxis plotAxis ) std::vector allTimeSteps; for ( RimSummaryCurve* curve : stackedCurves ) { - allTimeSteps.insert( allTimeSteps.end(), curve->timeStepsY().begin(), curve->timeStepsY().end() ); + auto timeSteps = curve->timeStepsY(); + if ( !timeSteps.empty() ) + { + // https://github.com/OPM/ResInsight/issues/10438 + allTimeSteps.insert( allTimeSteps.end(), timeSteps.begin(), timeSteps.end() ); + } } std::sort( allTimeSteps.begin(), allTimeSteps.end() ); allTimeSteps.erase( std::unique( allTimeSteps.begin(), allTimeSteps.end() ), allTimeSteps.end() );