1 files changed, 2 insertions, 6 deletions
diff --git a/src/Cache.cpp b/src/Cache.cpp
index 4f96f430..f22afc7f 100644
--- a/src/Cache.cpp
+++ b/src/Cache.cpp
@@ -1857,16 +1857,12 @@ Cache::getTimelineMessages(lmdb::txn &txn, const std::string &room_id, uint64_t
auto cursor = lmdb::cursor::open(txn, orderDb);
if (index == std::numeric_limits<uint64_t>::max()) {
- if (cursor.get(indexVal, event_id, forward ? MDB_FIRST : MDB_LAST)) {
- index = lmdb::from_sv<uint64_t>(indexVal);
- } else {
+ if (!cursor.get(indexVal, event_id, forward ? MDB_FIRST : MDB_LAST)) {
messages.end_of_cache = true;
return messages;
}
} else {
- if (cursor.get(indexVal, event_id, MDB_SET)) {
- index = lmdb::from_sv<uint64_t>(indexVal);
- } else {
+ if (!cursor.get(indexVal, event_id, MDB_SET)) {
messages.end_of_cache = true;
return messages;
}
|