Add key validness checks before adding to FlatHashSet.

This commit is contained in:
levlam 2024-02-15 17:16:08 +03:00
parent 0369a1a185
commit 78f3363486
2 changed files with 2 additions and 0 deletions

View File

@ -17720,6 +17720,7 @@ bool MessagesManager::set_folder_pinned_dialogs(FolderId folder_id, vector<Dialo
FlatHashSet<DialogId, DialogIdHash> all_old_pinned_dialog_ids;
for (auto dialog_id : old_dialog_ids) {
CHECK(dialog_id.is_valid());
all_old_pinned_dialog_ids.insert(dialog_id);
}

View File

@ -767,6 +767,7 @@ bool SavedMessagesManager::set_pinned_saved_messages_topics(vector<SavedMessages
<< saved_messages_topic_ids;
FlatHashSet<SavedMessagesTopicId, SavedMessagesTopicIdHash> old_pinned_saved_messages_topic_ids;
for (auto pinned_saved_messages_topic_id : topic_list_.pinned_saved_messages_topic_ids_) {
CHECK(pinned_saved_messages_topic_id.is_valid());
old_pinned_saved_messages_topic_ids.insert(pinned_saved_messages_topic_id);
}