diff --git a/Linphone/core/chat/ChatCore.cpp b/Linphone/core/chat/ChatCore.cpp index 517abd3a9..a46e6024b 100644 --- a/Linphone/core/chat/ChatCore.cpp +++ b/Linphone/core/chat/ChatCore.cpp @@ -191,7 +191,8 @@ void ChatCore::setSelf(QSharedPointer me) { }); mChatModelConnection->makeConnectToCore(&ChatCore::lUpdateLastMessage, [this]() { - auto lastMessageModel = mLastEvent ? mLastEvent->getChatMessageCore()->getModel() : nullptr; + auto lastMessageModel = + mLastEvent && mLastEvent->getChatMessageCore() ? mLastEvent->getChatMessageCore()->getModel() : nullptr; mChatModelConnection->invokeToModel([this, lastMessageModel]() { auto linphoneMessage = mChatModel->getLastChatMessage(); if (!lastMessageModel || lastMessageModel->getMonitor() != linphoneMessage) {