Add some index checks.
This commit is contained in:
parent
ce5c3f32e7
commit
ab673a959b
@ -9531,6 +9531,7 @@ void ContactsManager::remove_inactive_channel(ChannelId channel_id) {
|
||||
}
|
||||
|
||||
void ContactsManager::register_message_users(MessageFullId message_full_id, vector<UserId> user_ids) {
|
||||
CHECK(message_full_id.get_dialog_id().is_valid());
|
||||
for (auto user_id : user_ids) {
|
||||
CHECK(user_id.is_valid());
|
||||
const User *u = get_user(user_id);
|
||||
|
@ -13259,6 +13259,7 @@ void MessagesManager::ttl_loop(double now) {
|
||||
TtlNode *ttl_node = TtlNode::from_heap_node(ttl_heap_.pop());
|
||||
auto message_full_id = ttl_node->message_full_id_;
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
CHECK(dialog_id.is_valid());
|
||||
if (dialog_id.get_type() == DialogType::SecretChat || ttl_node->by_ttl_period_) {
|
||||
to_delete[dialog_id].push_back(message_full_id.get_message_id());
|
||||
} else {
|
||||
@ -22032,6 +22033,7 @@ void MessagesManager::add_active_live_location(MessageFullId message_full_id) {
|
||||
if (td_->auth_manager_->is_bot()) {
|
||||
return;
|
||||
}
|
||||
CHECK(message_full_id.get_message_id().is_valid());
|
||||
if (!active_live_location_message_full_ids_.insert(message_full_id).second) {
|
||||
return;
|
||||
}
|
||||
|
@ -2529,6 +2529,7 @@ void StoryManager::on_get_dialog_expiring_stories(DialogId owner_dialog_id,
|
||||
td_->contacts_manager_->on_get_chats(std::move(stories->chats_), "on_get_dialog_expiring_stories");
|
||||
owner_dialog_id = on_get_dialog_stories(owner_dialog_id, std::move(stories->stories_), Promise<Unit>());
|
||||
if (promise) {
|
||||
CHECK(owner_dialog_id.is_valid());
|
||||
auto active_stories = get_active_stories(owner_dialog_id);
|
||||
if (updated_active_stories_.insert(owner_dialog_id)) {
|
||||
send_update_chat_active_stories(owner_dialog_id, active_stories, "on_get_dialog_expiring_stories");
|
||||
@ -4183,6 +4184,7 @@ void StoryManager::send_update_chat_active_stories(DialogId owner_dialog_id, con
|
||||
LOG(INFO) << "Skip update about active stories in " << owner_dialog_id << " from " << source;
|
||||
return;
|
||||
}
|
||||
CHECK(owner_dialog_id.is_valid());
|
||||
updated_active_stories_.insert(owner_dialog_id);
|
||||
}
|
||||
LOG(INFO) << "Send update about active stories in " << owner_dialog_id << " from " << source;
|
||||
@ -4816,6 +4818,7 @@ void StoryManager::do_send_story(unique_ptr<PendingStory> &&pending_story, vecto
|
||||
CHECK(pending_story->story_id_.is_valid());
|
||||
CHECK(pending_story->story_ != nullptr);
|
||||
CHECK(pending_story->story_->content_ != nullptr);
|
||||
CHECK(pending_story->story_id_.is_valid());
|
||||
|
||||
auto story_full_id = StoryFullId(pending_story->dialog_id_, pending_story->story_id_);
|
||||
if (bad_parts.empty()) {
|
||||
@ -5323,6 +5326,7 @@ void StoryManager::delete_story(DialogId owner_dialog_id, StoryId story_id, Prom
|
||||
return promise.set_error(Status::Error(400, "Story not found"));
|
||||
}
|
||||
int64 random_id = random_id_it->second;
|
||||
CHECK(random_id != 0);
|
||||
|
||||
LOG(INFO) << "Cancel uploading of " << story_full_id;
|
||||
|
||||
|
@ -200,6 +200,7 @@ void FileStatsWorker::get_stats(bool need_all_files, bool split_by_owner_dialog_
|
||||
return;
|
||||
}
|
||||
// LOG(INFO) << "Match! " << db_info.path << " from " << db_info.owner_dialog_id;
|
||||
CHECK(it->second < full_infos.size());
|
||||
auto &full_info = full_infos[it->second];
|
||||
full_info.owner_dialog_id = db_info.owner_dialog_id;
|
||||
full_info.file_type = db_info.file_type; // database file_type is the correct one
|
||||
|
Loading…
x
Reference in New Issue
Block a user