2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Fix possible assertion violation.

Allow removing local HistoryItem's after the album was already sent.
This commit is contained in:
John Preston
2018-01-03 12:06:02 +03:00
parent 54dd05c556
commit 2868899d81
3 changed files with 44 additions and 25 deletions

View File

@@ -2960,7 +2960,15 @@ void ApiWrap::sendAlbumWithCancelled(
const MessageGroupId &groupId) {
const auto localId = item->fullId();
const auto albumIt = _sendingAlbums.find(groupId.raw());
Assert(albumIt != _sendingAlbums.end());
if (albumIt != _sendingAlbums.end()) {
// Sometimes we destroy item being sent already after the album
// was sent successfully. For example the message could be loaded
// from server (by messages.getHistory or updateNewMessage) and
// added to history and after that updateMessageID was received with
// the same message id, in this case we destroy a detached local
// item and sendAlbumWithCancelled is called for already sent album.
return;
}
const auto &album = albumIt->second;
const auto proj = [](const SendingAlbum::Item &item) {