Fix poll crash

This commit is contained in:
Andrea Cavalli 2021-01-12 03:05:27 +01:00
parent 241ee13727
commit 2ebb310101

View File

@ -495,7 +495,15 @@ vector<int32> PollManager::get_vote_percentage(const vector<int32> &voter_counts
td_api::object_ptr<td_api::poll> PollManager::get_poll_object(PollId poll_id) const { td_api::object_ptr<td_api::poll> PollManager::get_poll_object(PollId poll_id) const {
auto poll = get_poll(poll_id); auto poll = get_poll(poll_id);
CHECK(poll != nullptr); if (!(poll != nullptr)) {
vector<td_api::object_ptr<td_api::pollOption>> opts;
vector<int32> votes;
return td_api::make_object<td_api::poll>(
poll_id.get(), poll->question, std::move(opts), 0,
std::move(votes), true,
std::move(td_api::make_object<td_api::pollTypeRegular>(false)),
1, G()->unix_time() - 1, poll->is_closed);
}
return get_poll_object(poll_id, poll); return get_poll_object(poll_id, poll);
} }