mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-03 20:20:48 -06:00
#1355 Fixed crash when calculating statistics for visible cells without data for all time steps
This commit is contained in:
parent
a23d6a7ebc
commit
d32461f0ee
@ -55,6 +55,13 @@ private:
|
|||||||
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
|
void traverseCells(StatisticsAccumulator& accumulator, size_t timeStepIndex)
|
||||||
{
|
{
|
||||||
std::vector<double>& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
std::vector<double>& values = m_caseData->cellScalarResults(m_scalarResultIndex, timeStepIndex);
|
||||||
|
|
||||||
|
if (values.empty())
|
||||||
|
{
|
||||||
|
// Can happen if values do not exist for the current time step index.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo();
|
const RigActiveCellInfo* actCellInfo = m_caseData->activeCellInfo();
|
||||||
size_t cellCount = actCellInfo->reservoirCellCount();
|
size_t cellCount = actCellInfo->reservoirCellCount();
|
||||||
|
|
||||||
@ -70,7 +77,10 @@ private:
|
|||||||
cellResultIndex = actCellInfo->cellResultIndex(cIdx);
|
cellResultIndex = actCellInfo->cellResultIndex(cIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cellResultIndex != cvf::UNDEFINED_SIZE_T) accumulator.addValue(values[cellResultIndex]);
|
if (cellResultIndex != cvf::UNDEFINED_SIZE_T && cellResultIndex < values.size())
|
||||||
|
{
|
||||||
|
accumulator.addValue(values[cellResultIndex]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user