Add early exit for invalid times.

This commit is contained in:
Bartosz Taudul 2019-10-20 18:47:50 +02:00
parent d592af9c2f
commit 5c92eae3ed

View File

@ -1847,6 +1847,7 @@ uint64_t Worker::GetPidFromTid( uint64_t tid ) const
void Worker::GetCpuUsageAtTime( int64_t time, int& own, int& other ) const void Worker::GetCpuUsageAtTime( int64_t time, int& own, int& other ) const
{ {
own = other = 0; own = other = 0;
if( time < 0 || time > m_data.lastTime ) return;
for( int i=0; i<m_data.cpuDataCount; i++ ) for( int i=0; i<m_data.cpuDataCount; i++ )
{ {
auto& cs = m_data.cpuData[i].cs; auto& cs = m_data.cpuData[i].cs;