From 19905e348a1028c72133906ee0e07e6f383cf862 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Tue, 29 Dec 2020 09:44:13 +0100 Subject: [PATCH] fix: Missing null check --- lib/src/room.dart | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/src/room.dart b/lib/src/room.dart index 751f83d6..54ae8c5f 100644 --- a/lib/src/room.dart +++ b/lib/src/room.dart @@ -445,9 +445,11 @@ class Room { EventType.MarkedUnread, MarkedUnread(unread).toJson(), ); - if (unread == false) { - await sendReadMarker(lastEvent.eventId, - readReceiptLocationEventId: lastEvent.eventId); + if (unread == false && lastEvent != null) { + await sendReadMarker( + lastEvent.eventId, + readReceiptLocationEventId: lastEvent.eventId, + ); } }