Fix compilation warning in searchmodel

This commit is contained in:
Tobias Fella
2023-08-30 01:02:28 +02:00
parent 35313271a3
commit a9965acdd3

View File

@@ -118,12 +118,7 @@ QVariant SearchModel::data(const QModelIndex &index, int role) const
return m_room->getUser(nullptr); return m_room->getUser(nullptr);
} }
case ReplyRole: case ReplyRole:
if (role == ReplyRole) { if (auto replyPtr = m_room->getReplyForEvent(event)) {
auto replyPtr = m_room->getReplyForEvent(event);
if (!replyPtr) {
return {};
}
MessageEventModel::DelegateType type; MessageEventModel::DelegateType type;
if (auto e = eventCast<const RoomMessageEvent>(replyPtr)) { if (auto e = eventCast<const RoomMessageEvent>(replyPtr)) {
switch (e->msgtype()) { switch (e->msgtype()) {
@@ -155,12 +150,12 @@ QVariant SearchModel::data(const QModelIndex &index, int role) const
} else { } else {
type = MessageEventModel::DelegateType::Other; type = MessageEventModel::DelegateType::Other;
} }
return QVariantMap{ return QVariantMap{
{"display"_ls, m_room->eventToString(*replyPtr, Qt::RichText)}, {"display"_ls, m_room->eventToString(*replyPtr, Qt::RichText)},
{"type"_ls, type}, {"type"_ls, type},
}; };
} }
break;
case IsPendingRole: case IsPendingRole:
return false; return false;
case ShowLinkPreviewRole: case ShowLinkPreviewRole: