diff --git a/td/telegram/ContactsManager.cpp b/td/telegram/ContactsManager.cpp index d8eb6df98..9d4f52b09 100644 --- a/td/telegram/ContactsManager.cpp +++ b/td/telegram/ContactsManager.cpp @@ -12986,17 +12986,23 @@ bool ContactsManager::get_channel_has_linked_channel(const Channel *c) { } ChannelId ContactsManager::get_channel_linked_channel_id(ChannelId channel_id) { - auto channel_full = get_channel_full_force(channel_id, "get_channel_linked_channel_id"); + auto channel_full = get_channel_full_const(channel_id); if (channel_full == nullptr) { - return ChannelId(); + channel_full = get_channel_full_force(channel_id, "get_channel_linked_channel_id"); + if (channel_full == nullptr) { + return ChannelId(); + } } return channel_full->linked_channel_id; } int32 ContactsManager::get_channel_slow_mode_delay(ChannelId channel_id) { - auto channel_full = get_channel_full_force(channel_id, "get_channel_slow_mode_delay"); + auto channel_full = get_channel_full_const(channel_id); if (channel_full == nullptr) { - return 0; + channel_full = get_channel_full_force(channel_id, "get_channel_slow_mode_delay"); + if (channel_full == nullptr) { + return 0; + } } return channel_full->slow_mode_delay; } @@ -13078,7 +13084,7 @@ void ContactsManager::reload_channel(ChannelId channel_id, Promise &&promi td_->create_handler(std::move(promise))->send(std::move(input_channel)); } -const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id) const { +const ContactsManager::ChannelFull *ContactsManager::get_channel_full_const(ChannelId channel_id) const { auto p = channels_full_.find(channel_id); if (p == channels_full_.end()) { return nullptr; @@ -13087,6 +13093,10 @@ const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId } } +const ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id) const { + return get_channel_full_const(channel_id); +} + ContactsManager::ChannelFull *ContactsManager::get_channel_full(ChannelId channel_id, const char *source) { auto p = channels_full_.find(channel_id); if (p == channels_full_.end()) { diff --git a/td/telegram/ContactsManager.h b/td/telegram/ContactsManager.h index 57d546546..85a9a250e 100644 --- a/td/telegram/ContactsManager.h +++ b/td/telegram/ContactsManager.h @@ -1105,6 +1105,7 @@ class ContactsManager : public Actor { Channel *add_channel(ChannelId channel_id, const char *source); const ChannelFull *get_channel_full(ChannelId channel_id) const; + const ChannelFull *get_channel_full_const(ChannelId channel_id) const; ChannelFull *get_channel_full(ChannelId channel_id, const char *source); ChannelFull *get_channel_full_force(ChannelId channel_id, const char *source);