Fix crash in history clear.

This commit is contained in:
John Preston 2019-04-12 17:06:33 +04:00
parent 60e36b1411
commit cc8f4aa24f
1 changed files with 2 additions and 2 deletions

View File

@ -2947,8 +2947,8 @@ void History::clear(ClearType type) {
changeUnreadCount(-unreadCount());
if (type == ClearType::DeleteChat) {
setLastMessage(nullptr);
} else {
if (_lastMessage && IsServerMsgId((*_lastMessage)->id)) {
} else if (_lastMessage && *_lastMessage) {
if (IsServerMsgId((*_lastMessage)->id)) {
(*_lastMessage)->applyEditionToHistoryCleared();
} else {
_lastMessage = std::nullopt;