Add checks for null user.

This commit is contained in:
levlam 2024-01-25 19:11:54 +03:00
parent 4464a8479b
commit f2262cdcfb

View File

@ -5538,7 +5538,9 @@ void ContactsManager::can_send_message_to_user(
if (!have_input_peer_user(u, user_id, AccessRights::Write)) {
return promise.set_value(td_api::make_object<td_api::canSendMessageToUserResultUserIsDeleted>());
}
if (!u->contact_require_premium || td_->option_manager_->get_option_boolean("is_premium") || u->is_mutual_contact) {
CHECK(user_id.is_valid());
if ((u != nullptr && (!u->contact_require_premium || u->is_mutual_contact)) ||
td_->option_manager_->get_option_boolean("is_premium")) {
return promise.set_value(td_api::make_object<td_api::canSendMessageToUserResultOk>());
}