diff --git a/Telegram/SourceFiles/data/data_download_manager.cpp b/Telegram/SourceFiles/data/data_download_manager.cpp index c1a0719feb..eaf1248310 100644 --- a/Telegram/SourceFiles/data/data_download_manager.cpp +++ b/Telegram/SourceFiles/data/data_download_manager.cpp @@ -833,11 +833,14 @@ void DownloadManager::cancel( SessionData &data, std::vector::iterator i) { const auto object = i->object; + const auto item = object.item; remove(data, i); - if (const auto document = object.document) { - document->cancel(); - } else if (const auto photo = object.photo) { - photo->cancel(); + if (!item->isAdminLogEntry()) { + if (const auto document = object.document) { + document->cancel(); + } else if (const auto photo = object.photo) { + photo->cancel(); + } } } diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index fe5a1a41e0..5b75925d8e 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -495,8 +495,10 @@ void History::destroyMessage(not_null item) { session().api().cancelLocalItem(item); } - const auto document = [&] { - const auto media = item->media(); + const auto documentToCancel = [&] { + const auto media = item->isAdminLogEntry() + ? nullptr + : item->media(); return media ? media->document() : nullptr; }(); @@ -510,8 +512,8 @@ void History::destroyMessage(not_null item) { Assert(i != end(_messages)); _messages.erase(i); - if (document) { - session().data().documentMessageRemoved(document); + if (documentToCancel) { + session().data().documentMessageRemoved(documentToCancel); } }