From 9b498149bed19a7cac748aa74032d17b3cfe05d9 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sun, 7 Jan 2024 21:37:47 +0200 Subject: [PATCH] Fix panic when handling read receipt if user isn't connected --- portal.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/portal.go b/portal.go index b9c2ce0..4b8221f 100644 --- a/portal.go +++ b/portal.go @@ -1983,6 +1983,10 @@ func (portal *Portal) HandleMatrixReadReceipt(brUser bridge.User, eventID id.Eve Time("receipt_ts", receipt.Timestamp). Str("action", "handle matrix read receipt"). Logger() + if user.Client == nil { + log.Debug().Msg("User is not connected, ignoring read receipt") + return + } ctx := log.WithContext(context.TODO()) log.Debug().Msg("Handling Matrix read receipt") targetMessage, err := portal.bridge.DB.Message.GetByMXID(ctx, eventID)