Fix possible assertion violation in non-self reaction.
This commit is contained in:
parent
1697e9e791
commit
4eefebc96c
|
@ -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)) {
|
||||||
j->second.erase(
|
if (removed) {
|
||||||
ranges::remove(j->second, self, &RecentReaction::peer),
|
j->second.clear();
|
||||||
end(j->second));
|
|
||||||
if (j->second.empty()) {
|
|
||||||
_recent.erase(j);
|
_recent.erase(j);
|
||||||
} else {
|
} else {
|
||||||
Assert(!removed);
|
j->second.erase(
|
||||||
|
ranges::remove(j->second, self, &RecentReaction::peer),
|
||||||
|
end(j->second));
|
||||||
|
if (j->second.empty()) {
|
||||||
|
_recent.erase(j);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return removed;
|
return removed;
|
||||||
|
|
Loading…
Reference in New Issue