mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#1767 Guard for use of index out of bounds
This commit is contained in:
parent
0d57d3ec8d
commit
cfddaa98ca
@ -193,11 +193,15 @@ QString RimTimeStepFilter::filteredTimeStepsAsText() const
|
||||
|
||||
QString formatString = RimTools::createTimeFormatStringFromDates(timeSteps);
|
||||
|
||||
for (auto index : m_selectedTimeStepIndices.v())
|
||||
for (auto selectedIndex : m_selectedTimeStepIndices.v())
|
||||
{
|
||||
QString stepText = timeSteps[static_cast<size_t>(index)].toString(formatString);
|
||||
text += stepText;
|
||||
text += "\n";
|
||||
size_t timeStepIndex = static_cast<size_t>(selectedIndex);
|
||||
|
||||
if (timeStepIndex < timeSteps.size())
|
||||
{
|
||||
text += timeSteps[timeStepIndex].toString(formatString);
|
||||
text += "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
|
Loading…
Reference in New Issue
Block a user