Verify the event is chat before accessing the model

This commit is contained in:
Christophe Deschamps 2025-05-27 18:03:19 +02:00
parent 9cd136938b
commit 1666d7b897

View file

@ -191,7 +191,8 @@ void ChatCore::setSelf(QSharedPointer<ChatCore> 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) {