diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index d7903726f5..ae9afd26a1 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -6516,7 +6516,7 @@ void HistoryWidget::onAnimActiveStep() { return _animActiveTimer.stop(); } - HistoryItem *item = (_activeAnimMsgId > 0) ? App::histItemById(_channel, _activeAnimMsgId) : App::histItemById(_migrated->channelId(), -_activeAnimMsgId); + HistoryItem *item = (_activeAnimMsgId < 0 && -_activeAnimMsgId < ServerMaxMsgId && _migrated) ? App::histItemById(_migrated->channelId(), -_activeAnimMsgId) : App::histItemById(_channel, _activeAnimMsgId); if (!item || item->detached()) return _animActiveTimer.stop(); if (getms() - _animActiveStart > st::activeFadeInDuration + st::activeFadeOutDuration) { diff --git a/Telegram/SourceFiles/mediaview.cpp b/Telegram/SourceFiles/mediaview.cpp index 21ee4d8676..aca6465ed1 100644 --- a/Telegram/SourceFiles/mediaview.cpp +++ b/Telegram/SourceFiles/mediaview.cpp @@ -1538,12 +1538,14 @@ void MediaView::preloadData(int32 delta) { for (int32 i = from; i <= to; ++i) { History *previewHistory = _msgmigrated ? _migrated : _history; int32 previewIndex = i; - if (_msgmigrated && previewIndex >= _migrated->overview[_overview].size()) { - previewHistory = _history; - previewIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); - } else if (!_msgmigrated && previewIndex < 0) { - previewHistory = _migrated; - previewIndex += _migrated->overview[_overview].size(); + if (_migrated) { + if (_msgmigrated && previewIndex >= _migrated->overview[_overview].size()) { + previewHistory = _history; + previewIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); + } else if (!_msgmigrated && previewIndex < 0) { + previewHistory = _migrated; + previewIndex += _migrated->overview[_overview].size(); + } } if (previewIndex >= 0 && previewIndex < previewHistory->overview[_overview].size() && (previewHistory != (_msgmigrated ? _migrated : _history) || previewIndex != _index)) { if (HistoryItem *item = App::histItemById(previewHistory->channelId(), previewHistory->overview[_overview][previewIndex])) { @@ -1559,12 +1561,14 @@ void MediaView::preloadData(int32 delta) { } int32 forgetIndex = _index - delta * 2; History *forgetHistory = _msgmigrated ? _migrated : _history; - if (_msgmigrated && forgetIndex >= _migrated->overview[_overview].size()) { - forgetHistory = _history; - forgetIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); - } else if (!_msgmigrated && forgetIndex < 0) { - forgetHistory = _migrated; - forgetIndex += _migrated->overview[_overview].size(); + if (_migrated) { + if (_msgmigrated && forgetIndex >= _migrated->overview[_overview].size()) { + forgetHistory = _history; + forgetIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); + } else if (!_msgmigrated && forgetIndex < 0) { + forgetHistory = _migrated; + forgetIndex += _migrated->overview[_overview].size(); + } } if (forgetIndex >= 0 && forgetIndex < forgetHistory->overview[_overview].size() && (forgetHistory != (_msgmigrated ? _migrated : _history) || forgetIndex != _index)) { if (HistoryItem *item = App::histItemById(forgetHistory->channelId(), forgetHistory->overview[_overview][forgetIndex])) {