diff --git a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp index d6f363f4cd..948cdc0059 100644 --- a/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp +++ b/ApplicationCode/ReservoirDataModel/RigCaseCellResultsData.cpp @@ -2808,7 +2808,9 @@ void RigCaseCellResultsData::assignValuesToTemporaryLgrs(const QString& re //-------------------------------------------------------------------------------------------------- RigStatisticsDataCache* RigCaseCellResultsData::statistics(const RigEclipseResultAddress& resVarAddr) { - return m_statisticsDataCache[findScalarResultIndexFromAddress(resVarAddr)].p(); + size_t scalarResultIndex = findScalarResultIndexFromAddress(resVarAddr); + CAF_ASSERT(scalarResultIndex < m_statisticsDataCache.size()); + return m_statisticsDataCache[scalarResultIndex].p(); }