From d112d6b11fe0ad49835c2e31d132364333b94dc3 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Sat, 6 Nov 2021 00:40:39 +0100 Subject: [PATCH] Fix crash when clearing empty timeline --- src/Cache.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Cache.cpp b/src/Cache.cpp index 58eb2630..b2db9edd 100644 --- a/src/Cache.cpp +++ b/src/Cache.cpp @@ -3182,9 +3182,11 @@ Cache::clearTimeline(const std::string &room_id) break; } - do { - lmdb::cursor_del(msgCursor); - } while (msgCursor.get(indexVal, val, MDB_PREV)); + if (!start) { + do { + lmdb::cursor_del(msgCursor); + } while (msgCursor.get(indexVal, val, MDB_PREV)); + } cursor.close(); msgCursor.close();