From 22a69f70da663fbe4f0365e5740bab505fc793cc Mon Sep 17 00:00:00 2001 From: SChernykh Date: Sat, 10 Oct 2020 11:22:19 +0200 Subject: [PATCH] Fix HashrateInterpolator::addDataPoint --- src/backend/common/HashrateInterpolator.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/backend/common/HashrateInterpolator.cpp b/src/backend/common/HashrateInterpolator.cpp index 0fa339a15..2edda6a62 100644 --- a/src/backend/common/HashrateInterpolator.cpp +++ b/src/backend/common/HashrateInterpolator.cpp @@ -55,10 +55,8 @@ void xmrig::HashrateInterpolator::addDataPoint(uint64_t count, uint64_t timeStam std::lock_guard l(m_lock); // Clean up old data - if (!m_data.empty()) { - while (timeStamp - m_data.front().second > LagMS * 2) { - m_data.pop_front(); - } + while (!m_data.empty() && (timeStamp - m_data.front().second > LagMS * 2)) { + m_data.pop_front(); } m_data.emplace_back(count, timeStamp);