diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index 05d7925377..5a3b69b974 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -1581,6 +1581,17 @@ void RigCaseCellResultsData::computeDepthRelatedResults() std::vector>& tops = this->cellScalarResults(topsResultGridIndex); std::vector>& bottom = this->cellScalarResults(bottomResultGridIndex); + // Make sure the size is at least active cells + { + size_t actCellCount = activeCellInfo()->reservoirActiveCellCount(); + if (depth[0].size() < actCellCount) depth[0].resize(actCellCount, std::numeric_limits::max()); + if (dx[0].size() < actCellCount) dx[0].resize(actCellCount, std::numeric_limits::max()); + if (dy[0].size() < actCellCount) dy[0].resize(actCellCount, std::numeric_limits::max()); + if (dz[0].size() < actCellCount) dz[0].resize(actCellCount, std::numeric_limits::max()); + if (tops[0].size() < actCellCount) tops[0].resize(actCellCount, std::numeric_limits::max()); + if (bottom[0].size() < actCellCount) bottom[0].resize(actCellCount, std::numeric_limits::max()); + } + size_t cellIdx = 0; for (cellIdx = 0; cellIdx < m_ownerMainGrid->globalCellArray().size(); cellIdx++) {