Fix crash.

GitOrigin-RevId: 4463222ba6259feb15ee74face187d430030401d
This commit is contained in:
levlam 2019-01-20 17:59:02 +03:00
parent 937db792cb
commit 9f6d9ec48c

View File

@ -12797,14 +12797,14 @@ const ScopeNotificationSettings *MessagesManager::get_scope_notification_setting
} }
DialogNotificationSettings *MessagesManager::get_dialog_notification_settings(DialogId dialog_id, bool force) { DialogNotificationSettings *MessagesManager::get_dialog_notification_settings(DialogId dialog_id, bool force) {
auto dialog = get_dialog_force(dialog_id); auto d = get_dialog_force(dialog_id);
if (dialog == nullptr) { if (d == nullptr) {
return nullptr; return nullptr;
} }
if (!force && !have_input_peer(dialog_id, AccessRights::Read)) { if (!force && !have_input_peer(dialog_id, AccessRights::Read)) {
return nullptr; return nullptr;
} }
return &dialog->notification_settings; return &d->notification_settings;
} }
ScopeNotificationSettings *MessagesManager::get_scope_notification_settings(NotificationSettingsScope scope) { ScopeNotificationSettings *MessagesManager::get_scope_notification_settings(NotificationSettingsScope scope) {
@ -19350,7 +19350,7 @@ void MessagesManager::on_dialog_bots_updated(DialogId dialog_id, vector<UserId>
} }
auto d = get_dialog_force(dialog_id); auto d = get_dialog_force(dialog_id);
if (d->reply_markup_message_id == MessageId()) { if (d == nullptr || d->reply_markup_message_id == MessageId()) {
return; return;
} }
const Message *m = get_message_force(d, d->reply_markup_message_id); const Message *m = get_message_force(d, d->reply_markup_message_id);
@ -20803,7 +20803,7 @@ MessagesManager::Message *MessagesManager::on_get_message_from_database(DialogId
return nullptr; return nullptr;
} }
// can succeed in private chats // can succeed in private and group chats
get_messages_from_server({FullMessageId{dialog_id, m->message_id}}, Auto()); get_messages_from_server({FullMessageId{dialog_id, m->message_id}}, Auto());
force_create_dialog(dialog_id, source); force_create_dialog(dialog_id, source);