From 92f664614b192d3e7aef816f52c485e8b65a2a5f Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Sun, 28 Mar 2021 12:50:00 +0200 Subject: [PATCH] Fix #18 --- td/telegram/PollManager.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/td/telegram/PollManager.cpp b/td/telegram/PollManager.cpp index 246139985..5d7a2e183 100644 --- a/td/telegram/PollManager.cpp +++ b/td/telegram/PollManager.cpp @@ -1177,8 +1177,12 @@ void PollManager::on_update_poll_timeout(PollId poll_id) { if (G()->close_flag()) { return; } + auto poll = get_poll(poll_id); - if (!(poll != nullptr)) return; + if (poll == nullptr) { + return; + } + if (poll->is_closed && poll->is_updated_after_close) { return; } @@ -1192,7 +1196,13 @@ void PollManager::on_update_poll_timeout(PollId poll_id) { return; } - auto full_message_id = *it->second.begin(); + auto full_message_id_set = std::move(it->second); + if (full_message_id_set.empty()) { + return; + } + + auto full_message_id = *full_message_id_set.begin(); + LOG(INFO) << "Fetching results of " << poll_id << " from " << full_message_id; auto query_promise = PromiseCreator::lambda([poll_id, generation = current_generation_, actor_id = actor_id(this)]( Result> &&result) {