From 7c3814cdcdf1c1b0132b839c5c607f4107967a3e Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 29 Aug 2022 17:27:00 +0400 Subject: [PATCH] Fix recent userpics display in reactions. --- .../history/view/reactions/history_view_reactions.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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; }();