crash fix for 0.9.11.dev version

This commit is contained in:
John Preston 2015-11-22 15:37:48 +03:00
parent 204977d48a
commit 032ca377cd
2 changed files with 17 additions and 13 deletions

View File

@ -6516,7 +6516,7 @@ void HistoryWidget::onAnimActiveStep() {
return _animActiveTimer.stop(); 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 (!item || item->detached()) return _animActiveTimer.stop();
if (getms() - _animActiveStart > st::activeFadeInDuration + st::activeFadeOutDuration) { if (getms() - _animActiveStart > st::activeFadeInDuration + st::activeFadeOutDuration) {

View File

@ -1538,12 +1538,14 @@ void MediaView::preloadData(int32 delta) {
for (int32 i = from; i <= to; ++i) { for (int32 i = from; i <= to; ++i) {
History *previewHistory = _msgmigrated ? _migrated : _history; History *previewHistory = _msgmigrated ? _migrated : _history;
int32 previewIndex = i; int32 previewIndex = i;
if (_msgmigrated && previewIndex >= _migrated->overview[_overview].size()) { if (_migrated) {
previewHistory = _history; if (_msgmigrated && previewIndex >= _migrated->overview[_overview].size()) {
previewIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); previewHistory = _history;
} else if (!_msgmigrated && previewIndex < 0) { previewIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size());
previewHistory = _migrated; } else if (!_msgmigrated && previewIndex < 0) {
previewIndex += _migrated->overview[_overview].size(); previewHistory = _migrated;
previewIndex += _migrated->overview[_overview].size();
}
} }
if (previewIndex >= 0 && previewIndex < previewHistory->overview[_overview].size() && (previewHistory != (_msgmigrated ? _migrated : _history) || previewIndex != _index)) { 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])) { 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; int32 forgetIndex = _index - delta * 2;
History *forgetHistory = _msgmigrated ? _migrated : _history; History *forgetHistory = _msgmigrated ? _migrated : _history;
if (_msgmigrated && forgetIndex >= _migrated->overview[_overview].size()) { if (_migrated) {
forgetHistory = _history; if (_msgmigrated && forgetIndex >= _migrated->overview[_overview].size()) {
forgetIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size()); forgetHistory = _history;
} else if (!_msgmigrated && forgetIndex < 0) { forgetIndex -= _migrated->overview[_overview].size() + (_history->overviewCount(_overview) - _history->overview[_overview].size());
forgetHistory = _migrated; } else if (!_msgmigrated && forgetIndex < 0) {
forgetIndex += _migrated->overview[_overview].size(); forgetHistory = _migrated;
forgetIndex += _migrated->overview[_overview].size();
}
} }
if (forgetIndex >= 0 && forgetIndex < forgetHistory->overview[_overview].size() && (forgetHistory != (_msgmigrated ? _migrated : _history) || forgetIndex != _index)) { 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])) { if (HistoryItem *item = App::histItemById(forgetHistory->channelId(), forgetHistory->overview[_overview][forgetIndex])) {