FileReferenceManager existance check

This commit is contained in:
Andrea Cavalli 2020-08-02 00:25:55 +02:00
parent 35fe9a1409
commit 22192cda3c

View File

@ -366,10 +366,13 @@ void FileReferenceManager::reload_photo(PhotoSizeSource source, Promise<Unit> pr
} }
void FileReferenceManager::memory_cleanup(FileId file_id) { void FileReferenceManager::memory_cleanup(FileId file_id) {
auto &node = nodes_[file_id]; auto find_node = nodes_.find(file_id);
if (find_node != nodes_.end()) {
auto &node = find_node->second;
node.query.reset(); node.query.reset();
node.file_source_ids.reset_position(); node.file_source_ids.reset_position();
nodes_.erase(file_id); nodes_.erase(file_id);
} }
}
} // namespace td } // namespace td