From 8077faed681d543942e3ff5550b4d893443b7329 Mon Sep 17 00:00:00 2001 From: "andrew (from workstation)" Date: Sun, 17 May 2020 12:34:14 +0200 Subject: [PATCH] fixes --- td/telegram/files/FileManager.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/td/telegram/files/FileManager.cpp b/td/telegram/files/FileManager.cpp index f1e71892..efa3833f 100644 --- a/td/telegram/files/FileManager.cpp +++ b/td/telegram/files/FileManager.cpp @@ -3716,13 +3716,14 @@ void FileManager::memory_cleanup() { /* DESTROY ASSOCIATED QUERIES */ for (auto &query_id : queries_container_.ids()) { auto query = queries_container_.get(query_id); - if (file_id.get() == query->file_id_.get()) { + if (query != nullptr && file_id.get() == query->file_id_.get()) { on_error(query_id, Status::Error(400, "FILE_DOWNLOAD_RESTART")); } } /* DESTROY ASSOCIATED NODE */ - file_nodes_[file_id_info_[file_id.get()].node_id_] = nullptr; + auto file_node_id = file_id_info_[file_id.get()].node_id_; + if (file_node_id != 0) { file_nodes_[file_node_id] = nullptr; } /* DESTROY ASSOCIATED FILE */ empty_file_ids_.push_back(file_id.get()); @@ -3732,7 +3733,7 @@ void FileManager::memory_cleanup() { /* DESTROY MAIN QUERY */ for (auto &query_id : queries_container_.ids()) { auto query = queries_container_.get(query_id); - if (((int32) i) == query->file_id_.get()) { + if (query != nullptr && ((int32) i) == query->file_id_.get()) { on_error(query_id, Status::Error(400, "FILE_DOWNLOAD_RESTART")); } }