Fixed crash when AverageSize= is set in Measure.

This commit is contained in:
spx 2011-02-19 21:30:22 +00:00
parent 6c36a662e5
commit 606afe79e6

View File

@ -447,14 +447,16 @@ bool CMeasure::PostUpdate()
{
if (m_AverageSize > 0)
{
if (!m_AverageValues.empty())
size_t averageValuesSize = m_AverageValues.size();
if (m_AverageSize != averageValuesSize)
{
m_AverageValues.resize(m_AverageSize, m_Value);
averageValuesSize = m_AverageValues.size();
m_AveragePos %= averageValuesSize;
}
m_AverageValues[m_AveragePos] = m_Value;
size_t averageValuesSize = m_AverageValues.size();
++m_AveragePos;
m_AveragePos %= averageValuesSize;