User reverse iterator instead of while loop

This commit is contained in:
Konstantinos Sideris 2018-07-15 18:58:09 +03:00
parent 4059f17e15
commit e6b45263bc

View file

@ -380,13 +380,9 @@ TimelineView::renderTopEvents(const std::vector<TimelineEvent> &events)
firstSender_.clear();
firstMsgTimestamp_ = QDateTime();
// Parse in reverse order to determine where we should not show sender's
// name.
auto ii = events.size();
while (ii != 0) {
--ii;
auto item = parseMessageEvent(events[ii], TimelineDirection::Top);
// Parse in reverse order to determine where we should not show sender's name.
for (auto it = events.rbegin(); it != events.rend(); ++it) {
auto item = parseMessageEvent(*it, TimelineDirection::Top);
if (item != nullptr)
items.push_back(item);