Add some debug information for crashes.

This commit is contained in:
John Preston 2018-01-01 23:23:18 +03:00
parent 9c72470c17
commit 3325106837
2 changed files with 8 additions and 0 deletions

View File

@ -356,7 +356,9 @@ Storage::SharedMediaTypesMask HistoryItem::sharedMediaTypes() const {
void HistoryItem::indexAsNewItem() {
if (IsServerMsgId(id)) {
CrashReports::SetAnnotation("addToUnreadMentions", QString::number(id));
addToUnreadMentions(UnreadMentionType::New);
CrashReports::ClearAnnotation("addToUnreadMentions");
if (const auto types = sharedMediaTypes()) {
Auth().storage().add(Storage::SharedMediaAddNew(
history()->peer->id,

View File

@ -3028,12 +3028,18 @@ void MediaView::findCurrent() {
? (_index | func::add(*_sharedMediaData->skippedBefore()))
: base::none;
_fullCount = _sharedMediaData->fullCount();
if (_index) {
Assert(*_index >= 0 && *_index < _sharedMediaData->size());
}
} else if (_userPhotosData) {
_index = _photo ? _userPhotosData->indexOf(_photo->id) : base::none;
_fullIndex = _userPhotosData->skippedBefore()
? (_index | func::add(*_userPhotosData->skippedBefore()))
: base::none;
_fullCount = _userPhotosData->fullCount();
if (_index) {
Assert(*_index >= 0 && *_index < _userPhotosData->size());
}
} else {
_index = _fullIndex = _fullCount = base::none;
}