Fix early exit not initializing values used later on.

This commit is contained in:
Bartosz Taudul 2023-06-06 17:46:49 +02:00
parent c57b8994f6
commit 2b191e157e
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -137,7 +137,13 @@ void TimelineItemPlot::Preprocess( const TimelineContext& ctx, TaskDispatch& td,
auto& vec = m_plot->data;
vec.ensure_sorted();
if( vec.front().time.Val() > vEnd || vec.back().time.Val() < vStart ) return;
if( vec.front().time.Val() > vEnd || vec.back().time.Val() < vStart )
{
m_plot->rMin = 0;
m_plot->rMax = 0;
m_plot->num = 0;
return;
}
auto it = std::lower_bound( vec.begin(), vec.end(), vStart, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );
auto end = std::lower_bound( it, vec.end(), vEnd, [] ( const auto& l, const auto& r ) { return l.time.Val() < r; } );