aboutsummaryrefslogtreecommitdiff
path: root/room.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'room.cpp')
-rw-r--r--room.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/room.cpp b/room.cpp
index 3b74607a..650b2ff0 100644
--- a/room.cpp
+++ b/room.cpp
@@ -252,9 +252,10 @@ bool Room::hasUnreadMessages()
Room::Timeline::const_iterator Room::Private::readMarker(const User* user) const
{
- return lastReadEventIds.contains(user) ?
- std::next(eventsIndex.value(lastReadEventIds.value(user))) :
- timeline.begin();
+ auto lastReadId = lastReadEventIds.value(user);
+ return lastReadId.isEmpty() ?
+ eventsIndex.value(lastReadId) + 1 :
+ timeline.begin();
}
QString Room::readMarkerEventId() const