Don't crash on empty creation event
This commit is contained in:
@@ -354,6 +354,9 @@ QVariant RoomListModel::data(const QModelIndex &index, int role) const
|
|||||||
return NeoChatRoomType::Direct;
|
return NeoChatRoomType::Direct;
|
||||||
}
|
}
|
||||||
const RoomCreateEvent *creationEvent = room->creation();
|
const RoomCreateEvent *creationEvent = room->creation();
|
||||||
|
if (!creationEvent) {
|
||||||
|
return NeoChatRoomType::Normal;
|
||||||
|
}
|
||||||
QJsonObject contentJson = creationEvent->contentJson();
|
QJsonObject contentJson = creationEvent->contentJson();
|
||||||
QJsonObject::const_iterator typeIter = contentJson.find("type");
|
QJsonObject::const_iterator typeIter = contentJson.find("type");
|
||||||
if (typeIter != contentJson.end()) {
|
if (typeIter != contentJson.end()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user