diff --git a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp index 96f479370..db1f72a18 100644 --- a/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp +++ b/Telegram/SourceFiles/history/view/reactions/history_view_reactions.cpp @@ -600,16 +600,15 @@ InlineListData InlineListDataFromMessage(not_null message) { if (recent.size() != result.reactions.size()) { return false; } - auto b = begin(recent); auto sum = 0; for (const auto &reaction : result.reactions) { - sum += reaction.count; - if (reaction.id != b->first - || reaction.count != b->second.size() - || sum > kMaxRecentUserpics) { + if ((sum += reaction.count) > kMaxRecentUserpics) { + return false; + } + const auto i = recent.find(reaction.id); + if (i == end(recent) || reaction.count != i->second.size()) { return false; } - ++b; } return true; }();