Add some checks.

This commit is contained in:
levlam 2024-04-21 02:37:54 +03:00
parent 01e30e5263
commit d0e8dd7b81

View File

@ -1127,6 +1127,7 @@ void QuickReplyManager::on_reload_quick_reply_shortcuts(
FlatHashSet<QuickReplyShortcutId, QuickReplyShortcutIdHash> old_shortcut_ids;
for (auto &shortcut : shortcuts_.shortcuts_) {
CHECK(shortcut->shortcut_id_.is_valid());
old_shortcut_ids.insert(shortcut->shortcut_id_);
}
FlatHashSet<QuickReplyShortcutId, QuickReplyShortcutIdHash> added_shortcut_ids;
@ -1385,6 +1386,7 @@ void QuickReplyManager::reorder_quick_reply_shortcuts(const vector<QuickReplySho
if (get_shortcut(shortcut_id) == nullptr) {
return promise.set_error(Status::Error(400, "Shortcut not found"));
}
CHECK(shortcut_id.is_valid());
unique_shortcut_ids.insert(shortcut_id);
}
if (unique_shortcut_ids.size() != shortcut_ids.size()) {