Fix two null pointer dereferences
This commit is contained in:
@@ -975,6 +975,9 @@ QVariant MessageEventModel::getLatestMessageFromIndex(const int baseline)
|
|||||||
for (auto it = timelineBottom; it != limit; ++it) {
|
for (auto it = timelineBottom; it != limit; ++it) {
|
||||||
auto evt = it->event();
|
auto evt = it->event();
|
||||||
auto e = eventCast<const RoomMessageEvent>(evt);
|
auto e = eventCast<const RoomMessageEvent>(evt);
|
||||||
|
if (!e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
auto content = (*it)->contentJson();
|
auto content = (*it)->contentJson();
|
||||||
|
|
||||||
|
|||||||
@@ -229,10 +229,13 @@ void RoomListModel::handleNotifications()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
oldNotifications += notification["event"].toObject()["event_id"].toString();
|
oldNotifications += notification["event"].toObject()["event_id"].toString();
|
||||||
|
|
||||||
auto room = m_connection->room(notification["room_id"].toString());
|
auto room = m_connection->room(notification["room_id"].toString());
|
||||||
|
auto currentRoom = RoomManager::instance().currentRoom();
|
||||||
|
bool roomIsActive = currentRoom && room->id() == currentRoom->id();
|
||||||
|
|
||||||
// If room exists, room is NOT active OR the application is NOT active, show notification
|
// If room exists, room is NOT active OR the application is NOT active, show notification
|
||||||
if (room && !(room->id() == RoomManager::instance().currentRoom()->id() && QGuiApplication::applicationState() == Qt::ApplicationActive)) {
|
if (room && !(roomIsActive && QGuiApplication::applicationState() == Qt::ApplicationActive)) {
|
||||||
// The room might have been deleted (for example rejected invitation).
|
// The room might have been deleted (for example rejected invitation).
|
||||||
auto sender = room->user(notification["event"].toObject()["sender"].toString());
|
auto sender = room->user(notification["event"].toObject()["sender"].toString());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user