From efc7cca5c7215265e117ef4c0181bd41d6f62829 Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 24 Apr 2019 12:39:47 +0200 Subject: [PATCH] #4355 Dual Porosity : Guard data access for fracture data values --- .../FileInterface/RifReaderEclipseOutput.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp index 44ed44c141..b6513f9f1e 100644 --- a/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp +++ b/ApplicationCode/FileInterface/RifReaderEclipseOutput.cpp @@ -2302,6 +2302,7 @@ void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(RiaDefines: actCellInfo->gridActiveCellCounts(i, matrixActiveCellCount); fracActCellInfo->gridActiveCellCounts(i, fractureActiveCellCount); + if (matrixOrFracture == RiaDefines::MATRIX_MODEL) { destinationResultValues->insert(destinationResultValues->end(), @@ -2310,9 +2311,16 @@ void RifReaderEclipseOutput::extractResultValuesBasedOnPorosityModel(RiaDefines: } else { - destinationResultValues->insert(destinationResultValues->end(), - sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount, - sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount + fractureActiveCellCount); + if ((matrixActiveCellCount + fractureActiveCellCount) > sourceResultValues.size()) + { + // Special handling of the situation where we only have data for one fracture mode + matrixActiveCellCount = 0; + } + + destinationResultValues->insert(destinationResultValues->end(), + sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount, + sourceResultValues.begin() + sourceStartPosition + matrixActiveCellCount + + fractureActiveCellCount); } sourceStartPosition += (matrixActiveCellCount + fractureActiveCellCount);