#4731 Fix more crashes for ensemble RFT data import

This commit is contained in:
Gaute Lindkvist
2019-09-19 10:46:35 +02:00
parent 9d62a0c84e
commit 596c18b903
2 changed files with 9 additions and 3 deletions

View File

@@ -221,7 +221,9 @@ void RifReaderEnsembleStatisticsRft::calculateStatistics( const RifEclipseRftAdd
if ( !allDepths.empty() )
{
// Make sure we end up with approximately the same amount of points as originally
size_t sizeMultiplier = allDepths.size() / dataSetSizeCalc.weightedMean();
// Since allDepths contain *valid* values, it can potentially be smaller than the mean.
// Thus we need to ensure sizeMultiplier is at least 1.
size_t sizeMultiplier = std::max( (size_t)1, allDepths.size() / dataSetSizeCalc.weightedMean() );
for ( size_t depthIdx = 0; depthIdx < allDepths.size(); depthIdx += sizeMultiplier )
{
std::vector<double> pressuresAtDepth;