From fb4127da9db32e5e18b14beaaabbee7adf9cc334 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 8 Jan 2017 14:09:17 +0900 Subject: Simplified Room::Private::readMarker() code --- room.cpp | 7 ++++--- 1 file 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 -- cgit v1.2.3