2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Fixed crash when user pins chat in remotely removed filter.

This commit is contained in:
23rd
2020-04-29 20:40:09 +03:00
committed by John Preston
parent c3c482aa50
commit 1630ad0804

View File

@@ -209,6 +209,16 @@ void TogglePinnedDialog(Dialogs::Key key, FilterId filterId) {
return TogglePinnedDialog(key);
}
const auto owner = &key.entry()->owner();
// This can happen when you remove this filter from another client.
if (!ranges::contains(
(&owner->session())->data().chatsFilters().list(),
filterId,
&Data::ChatFilter::id)) {
Ui::Toast::Show(tr::lng_cant_do_this(tr::now));
return;
}
const auto isPinned = !key.entry()->isPinnedDialog(filterId);
if (isPinned && PinnedLimitReached(key, filterId)) {
return;