From 8058f88fe239ea820aec4c5226c2349eea50766f Mon Sep 17 00:00:00 2001 From: Lanna Michalke Date: Mon, 1 Aug 2022 08:16:35 +0200 Subject: [PATCH] fix: missing null check Signed-off-by: Lanna Michalke --- lib/src/database/hive_collections_database.dart | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/src/database/hive_collections_database.dart b/lib/src/database/hive_collections_database.dart index a0cfc081..557b1152 100644 --- a/lib/src/database/hive_collections_database.dart +++ b/lib/src/database/hive_collections_database.dart @@ -21,6 +21,7 @@ import 'dart:convert'; import 'dart:math'; import 'dart:typed_data'; +import 'package:collection/collection.dart'; import 'package:hive/hive.dart'; import 'package:matrix/encryption/utils/olm_session.dart'; @@ -358,7 +359,9 @@ class HiveCollectionsDatabase extends DatabaseApi { .toList(); final rawEvents = await _eventsBox.getAll(keys); return rawEvents - .map((rawEvent) => Event.fromJson(copyMap(rawEvent!), room)) + .map((rawEvent) => + rawEvent != null ? Event.fromJson(copyMap(rawEvent), room) : null) + .whereNotNull() .toList(); }