Protect from accidental message_id removal.

GitOrigin-RevId: 622745e79f396f0998a27a6a8b1a434c2a25c138
This commit is contained in:
levlam 2019-04-03 15:32:05 +03:00
parent 28717876ad
commit 277d3a788f

View File

@ -10290,7 +10290,6 @@ void MessagesManager::set_dialog_pinned_message_notification(Dialog *d, MessageI
if (old_message_id == message_id) {
return;
}
CHECK(old_message_id != message_id);
VLOG(notifications) << "Change pinned message notification in " << d->dialog_id << " from " << old_message_id
<< " to " << message_id;
if (old_message_id.is_valid()) {
@ -19213,6 +19212,10 @@ bool MessagesManager::add_new_message_notification(Dialog *d, Message *m, bool f
if (is_pinned) {
set_dialog_pinned_message_notification(d, from_mentions ? m->message_id : MessageId());
}
if (!m->notification_id.is_valid()) {
// protection from accidental notification_id removal in set_dialog_pinned_message_notification
return false;
}
VLOG(notifications) << "Create " << m->notification_id << " with " << m->message_id << " in " << group_info.group_id
<< '/' << d->dialog_id;
int32 min_delay_ms = 0;