From 96b6dfde3ffe5976684c9f1db796cec897e31af3 Mon Sep 17 00:00:00 2001 From: levlam Date: Tue, 3 Apr 2018 03:08:17 +0300 Subject: [PATCH] Ensure that updates aren't sent after TDLib is closed just in case. GitOrigin-RevId: 43777eda7a32dbe956d45685475fa2dae912f968 --- td/telegram/Td.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/td/telegram/Td.cpp b/td/telegram/Td.cpp index 190f4fe33..2226f5953 100644 --- a/td/telegram/Td.cpp +++ b/td/telegram/Td.cpp @@ -4618,7 +4618,13 @@ Status Td::init(DbKey key) { } void Td::send_update(tl_object_ptr &&object) { - switch (object->get_id()) { + auto object_id = object->get_id(); + if (close_flag_ >= 5 && object_id != td_api::updateAuthorizationState::ID) { + // just in case + return; + } + + switch (object_id) { case td_api::updateFavoriteStickers::ID: case td_api::updateInstalledStickerSets::ID: case td_api::updateRecentStickers::ID: