diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 6f779b19b..bdd661330 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4223,14 +4223,15 @@ Status Td::init(DbKey key) { contacts_manager_->on_binlog_user_event(std::move(event)); } - for (auto &event : events.chat_events) { - contacts_manager_->on_binlog_chat_event(std::move(event)); - } - for (auto &event : events.channel_events) { contacts_manager_->on_binlog_channel_event(std::move(event)); } + // chats may contain links to channels, so should be inited after + for (auto &event : events.chat_events) { + contacts_manager_->on_binlog_chat_event(std::move(event)); + } + for (auto &event : events.secret_chat_events) { contacts_manager_->on_binlog_secret_chat_event(std::move(event)); }