diff --git a/Telegram/SourceFiles/storage/storage_sparse_ids_list.cpp b/Telegram/SourceFiles/storage/storage_sparse_ids_list.cpp index c3845ddcac..507f00c0a6 100644 --- a/Telegram/SourceFiles/storage/storage_sparse_ids_list.cpp +++ b/Telegram/SourceFiles/storage/storage_sparse_ids_list.cpp @@ -62,7 +62,9 @@ SparseIdsList::AddResult SparseIdsList::addRangeItemsAndCountNew( SparseIdsSliceUpdate &update, const Range &messages, MsgRange noSkipRange) { - Expects(noSkipRange.from <= noSkipRange.till); + if (noSkipRange.from <= noSkipRange.till) { + return { 0 }; // AyuGram: fix crash when using `saveDeletedMessages` + } if (noSkipRange.from == noSkipRange.till && std::begin(messages) == std::end(messages)) {