Shuffle code around a bit.

Crash reports point to addToUnreadMentions() call being corrupted.
New reports could show is it responsible or setLastMessage() call.
This commit is contained in:
John Preston 2017-12-18 15:17:58 +04:00
parent 37b018257e
commit d5de064019
1 changed files with 6 additions and 6 deletions

View File

@ -1274,13 +1274,8 @@ not_null<HistoryItem*> History::addNewItem(not_null<HistoryItem*> adding, bool n
recountGrouping(groupFrom, groupTill);
}
setLastMessage(adding);
if (newMsg) {
newItemAdded(adding);
}
adding->addToUnreadMentions(AddToUnreadMentionsMethod::New);
if (IsServerMsgId(adding->id)) {
adding->addToUnreadMentions(AddToUnreadMentionsMethod::New);
if (auto sharedMediaTypes = adding->sharedMediaTypes()) {
if (newMsg) {
Auth().storage().add(Storage::SharedMediaAddNew(
@ -1378,6 +1373,11 @@ not_null<HistoryItem*> History::addNewItem(not_null<HistoryItem*> adding, bool n
}
}
setLastMessage(adding);
if (newMsg) {
newItemAdded(adding);
}
return adding;
}