diff --git a/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp index 28fab47f5d..c2515d0a51 100644 --- a/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp +++ b/ApplicationLibCode/ReservoirDataModel/Well/RigWellTargetCandidatesGenerator.cpp @@ -677,8 +677,9 @@ std::vector statistics[i].totalPorvSoil += porvSoil[idx]; statistics[i].totalPorvSgas += porvSgas[idx]; statistics[i].totalPorvSoilAndSgas += porvSoilAndSgas[idx]; - statistics[i].totalFipOil += fipOil[idx]; - statistics[i].totalFipGas += fipGas[idx]; + + if ( idx < fipOil.size() ) statistics[i].totalFipOil += fipOil[idx]; + if ( idx < fipGas.size() ) statistics[i].totalFipGas += fipGas[idx]; double meanPermeability = ( permeabilityX[idx] + permeabilityY[idx] + permeabilityZ[idx] ) / 3.0; permeabilityCalculators[i].addValueAndWeight( meanPermeability, porv[idx] ); @@ -872,7 +873,7 @@ void RigWellTargetCandidatesGenerator::accumulateResultsForSingleCase( RimEclips if ( !std::isinf( clusterNum[resultIndex] ) && clusterNum[resultIndex] > 0 ) { occupancy[targetResultIndex]++; - for ( auto [resultName, vec] : resultNamesAndSamples ) + for ( const auto& [resultName, vec] : resultNamesAndSamples ) { namedOutputVector[resultName][targetResultIndex] = namedInputVector[resultName]->at( resultIndex ); }