From 6a44aae5fc7ad5d5ec47de338b6226a7d2c8bad5 Mon Sep 17 00:00:00 2001 From: spx Date: Sat, 22 Dec 2012 04:32:28 +0900 Subject: [PATCH] [MeterLine] Fixed crash when LineCount not equal to MeasureNameN http://rainmeter.net/forum/viewtopic.php?f=14&t=14388 --- Library/MeterLine.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Library/MeterLine.cpp b/Library/MeterLine.cpp index cd71ae03..3362e0a1 100644 --- a/Library/MeterLine.cpp +++ b/Library/MeterLine.cpp @@ -215,14 +215,11 @@ bool CMeterLine::Update() if (maxSize > 0) { + int allValuesSize = (int)m_AllValues.size(); int counter = 0; - std::vector::const_iterator i = m_Measures.begin(); - for ( ; i != m_Measures.end(); ++i) + for (auto i = m_Measures.cbegin(); counter < allValuesSize && i != m_Measures.cend(); ++i, ++counter) { - double value = (*i)->GetValue(); - - m_AllValues[counter][m_CurrentPos] = value; - ++counter; + m_AllValues[counter][m_CurrentPos] = (*i)->GetValue(); } ++m_CurrentPos;