2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 07:35:12 +00:00

Fix possible assertion violation in non-self reaction.

This commit is contained in:
John Preston
2023-04-23 18:41:14 +04:00
parent 1697e9e791
commit 4eefebc96c

View File

@@ -966,13 +966,16 @@ void MessageReactions::add(const ReactionId &id, bool addToRecent) {
const auto removed = !--one.count; const auto removed = !--one.count;
const auto j = _recent.find(one.id); const auto j = _recent.find(one.id);
if (j != end(_recent)) { if (j != end(_recent)) {
if (removed) {
j->second.clear();
_recent.erase(j);
} else {
j->second.erase( j->second.erase(
ranges::remove(j->second, self, &RecentReaction::peer), ranges::remove(j->second, self, &RecentReaction::peer),
end(j->second)); end(j->second));
if (j->second.empty()) { if (j->second.empty()) {
_recent.erase(j); _recent.erase(j);
} else { }
Assert(!removed);
} }
} }
return removed; return removed;