Fix crash in scheduled emoji interactions.

Fixes #17093.
This commit is contained in:
John Preston 2021-10-12 10:32:32 +04:00
parent 57345cec3b
commit 5aaa72e8cd
1 changed files with 4 additions and 1 deletions

View File

@ -46,9 +46,12 @@ EmojiInteractions::EmojiInteractions(not_null<Main::Session*> session)
: _session(session) {
_session->data().viewRemoved(
) | rpl::filter([=] {
return !_plays.empty();
return !_plays.empty() || !_delayed.empty();
}) | rpl::start_with_next([=](not_null<const Element*> view) {
_plays.erase(ranges::remove(_plays, view, &Play::view), end(_plays));
_delayed.erase(
ranges::remove(_delayed, view, &Delayed::view),
end(_delayed));
}, _lifetime);
_emojiSize = Sticker::EmojiSize();