From 1ef67fcd4b2605ce861bd3b3d80542592b04e2fe Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Thu, 24 Oct 2019 09:53:53 +0000 Subject: [PATCH] [Sdk] fix minor bugs --- lib/src/Connection.dart | 2 +- lib/src/RoomList.dart | 2 +- lib/src/Timeline.dart | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/Connection.dart b/lib/src/Connection.dart index 074c3c4..9a9951b 100644 --- a/lib/src/Connection.dart +++ b/lib/src/Connection.dart @@ -462,7 +462,7 @@ class Connection { } } - if (userTimestampMap[mxid]["ts"] is int) { + if (userTimestampMap[mxid].containsKey("ts")) { if (receiptStateContent[eventID] == null) receiptStateContent[eventID] = {"m.read": {}}; else if (receiptStateContent[eventID]["m.read"] == null) diff --git a/lib/src/RoomList.dart b/lib/src/RoomList.dart index 5ea3d51..a3ffdeb 100644 --- a/lib/src/RoomList.dart +++ b/lib/src/RoomList.dart @@ -180,7 +180,7 @@ class RoomList { bool sortLock = false; sort() { - if (sortLock) return; + if (sortLock || rooms.length < 2) return; sortLock = true; rooms?.sort((a, b) => b.timeCreated.toTimeStamp().compareTo(a.timeCreated.toTimeStamp())); diff --git a/lib/src/Timeline.dart b/lib/src/Timeline.dart index f64597a..ab0e16c 100644 --- a/lib/src/Timeline.dart +++ b/lib/src/Timeline.dart @@ -122,7 +122,7 @@ class Timeline { bool sortLock = false; sort() { - if (sortLock) return; + if (sortLock || events.length < 2) return; sortLock = true; events ?.sort((a, b) => b.time.toTimeStamp().compareTo(a.time.toTimeStamp()));