fix: sanity if room prev_batch null, populate it

This commit is contained in:
td 2025-05-06 11:31:38 +02:00
parent 4721adde22
commit ec855ee525
No known key found for this signature in database
GPG Key ID: 62A30523D4D6CE28
1 changed files with 3 additions and 2 deletions

View File

@ -2991,8 +2991,9 @@ class Client extends MatrixApi {
chatUpdate.timeline?.prevBatch != null)) { chatUpdate.timeline?.prevBatch != null)) {
/// [InvitedRoomUpdate] doesn't have prev_batch, so we want to set it in case /// [InvitedRoomUpdate] doesn't have prev_batch, so we want to set it in case
/// the room first appeared in sync update when membership was invite. /// the room first appeared in sync update when membership was invite.
if ((rooms[roomIndex].membership == Membership.invite || if ((rooms[roomIndex].membership == Membership.invite ||
chatUpdate.timeline?.limited == true) && chatUpdate.timeline?.limited == true ||
rooms[roomIndex].prev_batch == null) &&
chatUpdate.timeline?.prevBatch != null) { chatUpdate.timeline?.prevBatch != null) {
rooms[roomIndex].prev_batch = chatUpdate.timeline?.prevBatch; rooms[roomIndex].prev_batch = chatUpdate.timeline?.prevBatch;
} }