Skip to content

Commit

Permalink
Don't increment cpuData index inline
Browse files Browse the repository at this point in the history
  • Loading branch information
jackun committed Feb 4, 2020
1 parent 6d3d869 commit bf45bd9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@ bool CPUStats::UpdateCoreMhz() {
while (std::getline(cpuInfo, row) && i < m_cpuData.size()) {
if (row.find("MHz") != std::string::npos){
row = std::regex_replace(row, std::regex(R"([^0-9.])"), "");
if (!try_stoi(m_cpuData[i++].mhz, row))
m_cpuData[i++].mhz = 0;
if (!try_stoi(m_cpuData[i].mhz, row))
m_cpuData[i].mhz = 0;
i++;
}
}
return true;
Expand Down

0 comments on commit bf45bd9

Please sign in to comment.