From 1e2ccabe85ecb5c625f047230d20c93e380da33f Mon Sep 17 00:00:00 2001 From: Krille Fear Date: Mon, 13 Sep 2021 16:42:55 +0200 Subject: [PATCH] fix: Missing null fallback when update notificationCount Previously when using RoomUpdate in the constructor the notificationCount to update was never null and set to 0 if it was missing. Now that we are no longer using it, I forgot to add the null fallback at this point. This leads to serious crashes in the apps at runtime and thats why I bump the version here as well! --- CHANGELOG.md | 3 +++ lib/src/client.dart | 5 +++-- pubspec.yaml | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0851b4f8..a5b94d38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [0.5.1] - 13nd Sep 2021 +- fix: Room.notificationCount set to null sometimes + ## [0.5.0] - 13nd Sep 2021 - hotfix: Key sharing security vulnerability! -> Please upgrade as soon as possible to this version - feat: MSC2746: Improved Signalling for 1:1 VoIP diff --git a/lib/src/client.dart b/lib/src/client.dart index cea6e880..c33c08f0 100644 --- a/lib/src/client.dart +++ b/lib/src/client.dart @@ -1513,8 +1513,9 @@ class Client extends MatrixApi { chatUpdate.timeline?.prevBatch != null)) { rooms[j].membership = membership; rooms[j].notificationCount = - chatUpdate.unreadNotifications?.notificationCount; - rooms[j].highlightCount = chatUpdate.unreadNotifications?.highlightCount; + chatUpdate.unreadNotifications?.notificationCount ?? 0; + rooms[j].highlightCount = + chatUpdate.unreadNotifications?.highlightCount ?? 0; if (chatUpdate.timeline?.prevBatch != null) { rooms[j].prev_batch = chatUpdate.timeline?.prevBatch; } diff --git a/pubspec.yaml b/pubspec.yaml index 81b38b2f..5d3705db 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: matrix description: Matrix Dart SDK -version: 0.5.0 +version: 0.5.1 homepage: https://famedly.com environment: