Don't crash on empty creation event

This commit is contained in:
Tobias Fella
2022-02-07 15:35:45 +01:00
parent ca8a21c0eb
commit 335ef240f5

View File

@@ -354,6 +354,9 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
return NeoChatRoomType::Direct;
}
const RoomCreateEvent *creationEvent = room->creation();
if (!creationEvent) {
return NeoChatRoomType::Normal;
}
QJsonObject contentJson = creationEvent->contentJson();
QJsonObject::const_iterator typeIter = contentJson.find("type");
if (typeIter != contentJson.end()) {