2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 15:45:12 +00:00

Attempt to fix a crash in getUserFull() without a loaded peer.

This commit is contained in:
John Preston
2016-10-22 18:58:14 +03:00
parent 130c41d711
commit c514c62d61
5 changed files with 64 additions and 44 deletions

View File

@@ -957,8 +957,9 @@ HistoryItem *History::addNewMessage(const MTPMessage &msg, NewMessageType type)
}
HistoryItem *History::addNewToLastBlock(const MTPMessage &msg, NewMessageType type) {
bool applyServiceAction = (type == NewMessageUnread), detachExistingItem = (type != NewMessageLast);
HistoryItem *item = createItem(msg, applyServiceAction, detachExistingItem);
auto applyServiceAction = (type == NewMessageUnread);
auto detachExistingItem = (type != NewMessageLast);
auto item = createItem(msg, applyServiceAction, detachExistingItem);
if (!item || !item->detached()) {
return item;
}
@@ -1139,7 +1140,6 @@ void History::newItemAdded(HistoryItem *item) {
outboxRead(item);
}
} else if (item->unread()) {
bool skip = false;
if (!isChannel() || peer->asChannel()->amIn()) {
notifies.push_back(item);
App::main()->newUnreadMsg(this, item);