Fix crash when clearing empty timeline

This commit is contained in:
Nicolas Werner 2021-11-06 00:40:39 +01:00
parent 3758c42ed6
commit d112d6b11f
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
1 changed files with 5 additions and 3 deletions

View File

@ -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();