Prevent division by zero.

This commit is contained in:
Bartosz Taudul 2020-05-08 01:55:03 +02:00
parent 70818b49b9
commit 8b56dd5468

View File

@ -3081,7 +3081,7 @@ void Worker::UpdateMbps( int64_t td )
m_mbpsData.mbps.erase( m_mbpsData.mbps.begin() ); m_mbpsData.mbps.erase( m_mbpsData.mbps.begin() );
m_mbpsData.mbps.emplace_back( bytes / ( td * 125.f ) ); m_mbpsData.mbps.emplace_back( bytes / ( td * 125.f ) );
} }
m_mbpsData.compRatio = float( bytes ) / decBytes; m_mbpsData.compRatio = decBytes == 0 ? 1 : float( bytes ) / decBytes;
m_mbpsData.queue = m_serverQueryQueue.size(); m_mbpsData.queue = m_serverQueryQueue.size();
m_mbpsData.transferred += bytes; m_mbpsData.transferred += bytes;
} }