Fix MessageContentModel crash

Make sure we check that the RoomMessageEvent exists before accessing anything
This commit is contained in:
James Graham
2024-11-23 22:20:05 +00:00
parent a37c9d6cea
commit 421f436871

View File

@@ -499,7 +499,10 @@ void MessageContentModel::updateReplyModel()
}
const auto roomMessageEvent = eventCast<const Quotient::RoomMessageEvent>(event.first);
if (!roomMessageEvent->isReply() || (roomMessageEvent && roomMessageEvent->isThreaded() && NeoChatConfig::self()->threads())) {
if (roomMessageEvent == nullptr) {
return;
}
if (!roomMessageEvent->isReply() || (roomMessageEvent->isThreaded() && NeoChatConfig::self()->threads())) {
if (m_replyModel) {
delete m_replyModel;
}